aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2025-05-26 07:55:55 -0500
committericeyrazor <iceyrazor@mailfence.com>2025-05-26 07:55:55 -0500
commit2e0d7ab640315333ceae1803e773acaec84e75d5 (patch)
tree72209c27a69a6781ebc53acf6e4d5d6b7388e8a8
parentda87b7fcdae6a8c5122e7a1cc5488d9f3860ed06 (diff)
added error checking to thumbnail so it wont make empty files
-rwxr-xr-xfetch.sh8
1 files 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))