From 2e0d7ab640315333ceae1803e773acaec84e75d5 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Mon, 26 May 2025 07:55:55 -0500 Subject: [PATCH] added error checking to thumbnail so it wont make empty files --- fetch.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fetch.sh b/fetch.sh index 9e84c77..3cb76c7 100755 --- a/fetch.sh +++ b/fetch.sh @@ -40,8 +40,12 @@ while :; do if [ -z "$(ls -l thumbnails | grep ".$urlid")" ]; then printf "$i::$urlid\n" thumbnailurl="$(yt-dlp --get-thumbnail "https://youtube.com/watch?v=$urlid" 2>> thumberr.txt)" - ext="$(printf "$thumbnailurl" | sed 's/.*\.//g' | sed 's/?.*//')" - wget "$thumbnailurl" -O "thumbnails/$urlid.$ext" + if [ ! "$thumbnailurl" == "" ]; then + ext="$(printf "$thumbnailurl" | sed 's/.*\.//g' | sed 's/?.*//')" + wget "$thumbnailurl" -O "thumbnails/$urlid.$ext" + else + echo could not download thumbnail $urlid + fi fi ((i=$i+1))