From 14ce842176dd64736f7d3135e39905548ffe06cf Mon Sep 17 00:00:00 2001 From: Michael Launay Date: Sun, 19 Jul 2020 20:00:28 +0200 Subject: [PATCH] Fixe 'content_html' error For some channels we have an error because "more" doesn't have "content_html" key. Exemple on version 2020.03.24 (same with this version) :: youtube-dl -f best -ciw -o "%(title)s.%(ext)s" -v "https://www.youtube.com/channel/UC0NCbj8CxzeCGIF6sODJ-7A/videos" [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-f', 'best', '-ciw', '-o', '%(title)s.%(ext)s', '-v', 'https://www.youtube.com/channel/UC0NCbj8CxzeCGIF6sODJ-7A/videos'] [debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8 [debug] youtube-dl version 2020.03.24 [debug] Python version 3.8.2 (CPython) - Linux-5.4.0-40-generic-x86_64-with-glibc2.29 [debug] exe versions: ffmpeg 4.2.2, ffprobe 4.2.2, rtmpdump 2.4 [debug] Proxy map: {} [youtube:channel] UC0NCbj8CxzeCGIF6sODJ-7A: Downloading channel page [youtube:playlist] UU0NCbj8CxzeCGIF6sODJ-7A: Downloading webpage [download] Downloading playlist: Uploads from Science4All [youtube:playlist] UU0NCbj8CxzeCGIF6sODJ-7A: Downloading page #1 ERROR: 'content_html' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info return self.process_ie_result(ie_result, download, extra_info) File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 968, in process_ie_result entries = list(itertools.islice( File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 313, in _entries content_html = more['content_html'] KeyError: 'content_html' --- youtube_dl/extractor/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index c27f2cd95..24599cad5 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -316,7 +316,7 @@ class YoutubeEntryListBaseInfoExtractor(YoutubeBaseInfoExtractor): continue raise - content_html = more['content_html'] + content_html = more['content_html'] if 'content_html' in more else "" if not content_html.strip(): # Some webpages show a "Load more" button but they don't # have more videos