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'
This commit is contained in:
Michael Launay 2020-07-19 20:00:28 +02:00 committed by GitHub
parent a115e07594
commit 14ce842176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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