diff options
| author | pypy <afanimusic@gmail.com> | 2019-05-09 02:58:47 +0900 | 
|---|---|---|
| committer | Sergey M <dstftw@gmail.com> | 2019-05-09 00:58:47 +0700 | 
| commit | b45a9e698e900cf3628963b77e5149e65857fdaf (patch) | |
| tree | b52244908b59db6ab5e5a1a48289a080935ef788 | |
| parent | 71ebd35d5003cfc5f4c8518249e03e1da0e620b4 (diff) | |
[youtube] Fix channel id extraction (closes #20982) (#21003)
| -rw-r--r-- | youtube_dl/extractor/youtube.py | 9 | 
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index 4002dcfdd..da202b9bc 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -2100,8 +2100,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor):          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  | 
