no error output if quota not exceeded
This commit is contained in:
parent
8c7b37ebe2
commit
e570157267
@ -56,7 +56,7 @@ for channel_id in $IDs; do
|
|||||||
if [ -z "$LEGACYMODE" ]; then
|
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")"
|
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
|
#Fallback to legacy mode if API quota is exceeded
|
||||||
if [ "$(echo "$json" | jq '."error"."errors"[]."reason"')" = '"quotaExceeded"' ];then
|
if [ "$(echo "$json" | jq '."error"."errors"[]."reason"' 2> /dev/null )" = '"quotaExceeded"' ];then
|
||||||
echo "YT API Quota exceeded, using fallback"
|
echo "YT API Quota exceeded, using fallback"
|
||||||
LEGACYMODE=1
|
LEGACYMODE=1
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user