]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Fix thumbnail URL
authorpukkandan <redacted>
Sun, 11 Apr 2021 00:33:02 +0000 (06:03 +0530)
committerpukkandan <redacted>
Sun, 11 Apr 2021 00:36:13 +0000 (06:06 +0530)
Closes: https://github.com/yt-dlp/yt-dlp/issues/233 https://github.com/ytdl-org/youtube-dl/issues/28023
yt_dlp/extractor/youtube.py

index 1130d10fa52174ef748717d9b46fc9ec475c35ec..168103377d7a0ce54c09ad5d6dc6fce6c7c1dde2 100644 (file)
@@ -2057,6 +2057,11 @@ def feed_entry(name):
                 thumbnail_url = thumbnail.get('url')
                 if not thumbnail_url:
                     continue
+                # Sometimes youtube gives a wrong thumbnail URL. See:
+                # https://github.com/yt-dlp/yt-dlp/issues/233
+                # https://github.com/ytdl-org/youtube-dl/issues/28023
+                if 'maxresdefault' in thumbnail_url:
+                    thumbnail_url = thumbnail_url.split('?')[0]
                 thumbnails.append({
                     'height': int_or_none(thumbnail.get('height')),
                     'url': thumbnail_url,