diff options
| author | iceyrazor <iceyrazor@mailfence.com> | 2025-05-26 07:55:55 -0500 |
|---|---|---|
| committer | iceyrazor <iceyrazor@mailfence.com> | 2025-05-26 07:55:55 -0500 |
| commit | 2e0d7ab640315333ceae1803e773acaec84e75d5 (patch) | |
| tree | 72209c27a69a6781ebc53acf6e4d5d6b7388e8a8 | |
| parent | da87b7fcdae6a8c5122e7a1cc5488d9f3860ed06 (diff) | |
added error checking to thumbnail so it wont make empty files
| -rwxr-xr-x | fetch.sh | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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)) |
