aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-12-19 20:25:01 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-12-19 20:25:01 +0530
commitdd0228ce1f708b12d7b1579438f63fda37c5bb48 (patch)
tree8284f44fcc6152bee55a44672b1d299d5b5277ca
parent37e57a9fd48a3f01be0cc7b510aaac6e534bd27f (diff)
downloadhypervideo-pre-dd0228ce1f708b12d7b1579438f63fda37c5bb48.tar.lz
hypervideo-pre-dd0228ce1f708b12d7b1579438f63fda37c5bb48.tar.xz
hypervideo-pre-dd0228ce1f708b12d7b1579438f63fda37c5bb48.zip
Remove known invalid thumbnails from `info_dict`
Related: https://github.com/yt-dlp/yt-dlp/issues/980#issuecomment-997396821
-rw-r--r--yt_dlp/YoutubeDL.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index ec69151d7..b5a2581c6 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -3685,7 +3685,7 @@ class YoutubeDL(object):
self.write_debug(f'Skipping writing {label} thumbnail')
return ret
- for t in thumbnails[::-1]:
+ for idx, t in list(enumerate(thumbnails))[::-1]:
thumb_ext = (f'{t["id"]}.' if multiple else '') + determine_ext(t['url'], 'jpg')
thumb_display_id = f'{label} thumbnail {t["id"]}'
thumb_filename = replace_extension(filename, thumb_ext, info_dict.get('ext'))
@@ -3706,6 +3706,7 @@ class YoutubeDL(object):
ret.append((thumb_filename, thumb_filename_final))
t['filepath'] = thumb_filename
except network_exceptions as err:
+ thumbnails.pop(idx)
self.report_warning(f'Unable to download {thumb_display_id}: {err}')
if ret and not write_all:
break