added nuked channel check to YT API requests
This commit is contained in:
parent
2f12e793bd
commit
613b68748c
7
ripper
7
ripper
@ -60,6 +60,8 @@ for channel_id in $IDs; do
|
||||
echo "YT-ID: $channel_id"
|
||||
if [ -z "$LEGACYMODE" ]; then
|
||||
json="$(curl -s "https://www.googleapis.com/youtube/v3/search?key=$APIKEY&channelId=$channel_id&part=snippet,id&order=date&maxResults=500")"
|
||||
|
||||
|
||||
#Fallback to legacy mode if API quota is exceeded
|
||||
if [ "$(echo "$json" | jq '."error"."errors"[]."reason"' 2> /dev/null )" = '"quotaExceeded"' ];then
|
||||
echo "YT API Quota exceeded, using fallback"
|
||||
@ -78,11 +80,16 @@ for channel_id in $IDs; do
|
||||
grep -vf "$BLACKLIST" >> /tmp/todownload$$
|
||||
fi
|
||||
else
|
||||
if [ "$(echo "$json" | jq '.pageInfo.totalResults')" -eq 0 ];then
|
||||
echo "Grabbing API data for channel returend no results"
|
||||
echo "Is https://youtube.com/channel/$channel_id still up?"
|
||||
else
|
||||
#Only try to download videos, not sheduled livestreams
|
||||
echo "$json" | jq '.items[] | select(.snippet.liveBroadcastContent != "upcoming") | .id.videoId' |
|
||||
tr -d '"' | grep -v '^null$'|
|
||||
sed 's/^/https:\/\/www\.youtube\.com\/watch\?v=/' |
|
||||
grep -vf "$BLACKLIST" >> /tmp/todownload$$
|
||||
fi
|
||||
fi
|
||||
done
|
||||
grep 'youtube' "$DLARCHIVE" | sed 's/youtube /https:\/\/www\.youtube\.com\/watch?v=/' > /tmp/alreadydownloaded$$
|
||||
|
Loading…
Reference in New Issue
Block a user