1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-23 00:54:31 +01:00

Add Channel Image in JSON info dict for YoutubeChannelIE

This commit is contained in:
Thomas Coleman 2020-07-19 23:31:48 -07:00
parent a4ed50bb84
commit c0784dc22d
2 changed files with 8 additions and 1 deletions

View File

@ -864,6 +864,8 @@ class YoutubeDL(object):
elif result_type == 'url': elif result_type == 'url':
# We have to add extra_info to the results because it may be # We have to add extra_info to the results because it may be
# contained in a playlist # contained in a playlist
if ie_result.get('channel_image'):
extra_info['channel_image'] = ie_result.get('channel_image')
return self.extract_info(ie_result['url'], return self.extract_info(ie_result['url'],
download, download,
ie_key=ie_result.get('ie_key'), ie_key=ie_result.get('ie_key'),
@ -998,6 +1000,7 @@ class YoutubeDL(object):
'extractor_key': ie_result['extractor_key'], 'extractor_key': ie_result['extractor_key'],
} }
extra.update(extra_info)
reason = self._match_entry(entry, incomplete=True) reason = self._match_entry(entry, incomplete=True)
if reason is not None: if reason is not None:
self.to_screen('[download] ' + reason) self.to_screen('[download] ' + reason)

View File

@ -2962,6 +2962,8 @@ class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
if channel_page is False: if channel_page is False:
channel_playlist_id = False channel_playlist_id = False
else: else:
channel_image = self._html_search_meta(
'og:image', channel_page, 'channel image', default=None)
channel_playlist_id = self._html_search_meta( channel_playlist_id = self._html_search_meta(
'channelId', channel_page, 'channel id', default=None) 'channelId', channel_page, 'channel id', default=None)
if not channel_playlist_id: if not channel_playlist_id:
@ -2974,8 +2976,10 @@ class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
channel_url, 'channel id', default=None) channel_url, 'channel id', default=None)
if channel_playlist_id and channel_playlist_id.startswith('UC'): if channel_playlist_id and channel_playlist_id.startswith('UC'):
playlist_id = 'UU' + channel_playlist_id[2:] playlist_id = 'UU' + channel_playlist_id[2:]
return self.url_result( url_result = self.url_result(
compat_urlparse.urljoin(url, '/playlist?list=%s' % playlist_id), 'YoutubePlaylist') compat_urlparse.urljoin(url, '/playlist?list=%s' % playlist_id), 'YoutubePlaylist')
url_result['channel_image'] = channel_image
return url_result
channel_page = self._download_webpage(url, channel_id, 'Downloading page #1') channel_page = self._download_webpage(url, channel_id, 'Downloading page #1')
autogenerated = re.search(r'''(?x) autogenerated = re.search(r'''(?x)