0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[youtube] Fix channel id extraction (closes #20982) (#21003)

This commit is contained in:
pypy 2019-05-09 02:58:47 +09:00 committed by Sergey M
parent 71ebd35d50
commit b45a9e698e

View file

@ -2100,8 +2100,13 @@ def _extract_filesize(media_url):
else:
self._downloader.report_warning('unable to extract uploader nickname')
channel_id = self._html_search_meta(
'channelId', video_webpage, 'channel id')
channel_id = (
str_or_none(video_details.get('channelId')) or
self._html_search_meta(
'channelId', video_webpage, 'channel id', default=None) or
self._search_regex(
r'data-channel-external-id=(["\'])(?P<id>(?:(?!\1).)+)\1',
video_webpage, 'channel id', default=None, group='id'))
channel_url = 'http://www.youtube.com/channel/%s' % channel_id if channel_id else None
# thumbnail image