diff --git a/ripper b/ripper index 460cf2e..49180f0 100755 --- a/ripper +++ b/ripper @@ -34,7 +34,7 @@ export PASSWORD_STORE_GPG_OPTS="--homedir=$XDG_DATA_HOME/gnupg" export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0" [ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" -APIKEY="$(pass show Misc/Youtube\ Data\ API\ v3 | head -n1 )" +APIKEY="$(pass show Misc/Youtube\ Data\ API\ v3 | head -n1)" LEGACYMODE=$1 #set to anything nonzero to ignore YT API [ -z "$APIKEY" ] && LEGACYMODE=1 @@ -49,7 +49,7 @@ echo "Scanning for new Videos to download" ##YOUTUBE echo "Scanning on YouTube..." -IDs="$( grep 'youtube' "$CHANNELSFILE" | grep -v '^#' | grep 'channel' | sed 's/https:\/\/www\.youtube\.com\/channel\///')" +IDs="$(grep 'youtube' "$CHANNELSFILE" | grep -v '^#' | grep 'channel' | sed 's/https:\/\/www\.youtube\.com\/channel\///')" not_correctly_formatted="$(grep 'youtube' "$CHANNELSFILE" | grep -v '^#' | grep -v 'https:\/\/www\.youtube\.com\/channel\/')" if [ -n "$not_correctly_formatted" ]; then echo Please fix the following channel urls to be scannable: @@ -65,13 +65,13 @@ for channel_id in $IDs; do 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 + if [ "$(echo "$json" | jq '."error"."errors"[]."reason"' 2> /dev/null)" = '"quotaExceeded"' ];then echo "YT API Quota exceeded, using fallback" LEGACYMODE=1 fi fi if [ -n "$LEGACYMODE" ];then - channelxml="$( curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id" )" + channelxml="$(curl -s "https://www.youtube.com/feeds/videos.xml?channel_id=$channel_id")" if echo "$channelxml" | grep -q '