From 6a176775778da34d89fde17afdf380f07f6f2d16 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Mon, 27 Dec 2021 03:18:11 +0530 Subject: [PATCH] [ThumbnailsConvertor] Fix for when there are no thumbnails Closes #2125 --- yt_dlp/postprocessor/ffmpeg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 222560a7c..96b48ded5 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -1092,12 +1092,12 @@ def run(self, info): files_to_delete = [] has_thumbnail = False - for idx, thumbnail_dict in enumerate(info['thumbnails']): - if 'filepath' not in thumbnail_dict: + for idx, thumbnail_dict in enumerate(info.get('thumbnails') or []): + original_thumbnail = thumbnail_dict.get('filepath') + if not original_thumbnail: continue has_thumbnail = True self.fixup_webp(info, idx) - original_thumbnail = thumbnail_dict['filepath'] _, thumbnail_ext = os.path.splitext(original_thumbnail) if thumbnail_ext: thumbnail_ext = thumbnail_ext[1:].lower()