mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 21:59:17 +00:00
[youtube:channel] Improve channel id extraction (#5904)
This commit is contained in:
parent
54eb81a087
commit
3d8e9573a4
|
@ -1406,10 +1406,12 @@ def _real_extract(self, url):
|
||||||
channel_page = self._download_webpage(
|
channel_page = self._download_webpage(
|
||||||
url + '?view=57', channel_id,
|
url + '?view=57', channel_id,
|
||||||
'Downloading channel page', fatal=False)
|
'Downloading channel page', fatal=False)
|
||||||
channel_playlist_id = self._search_regex(
|
channel_playlist_id = self._html_search_meta(
|
||||||
[r'<meta itemprop="channelId" content="([^"]+)">',
|
'channelId', channel_page, 'channel id', default=None)
|
||||||
r'data-channel-external-id="([^"]+)"'],
|
if not channel_playlist_id:
|
||||||
channel_page, 'channel id', default=None)
|
channel_playlist_id = self._search_regex(
|
||||||
|
r'data-channel-external-id="([^"]+)"',
|
||||||
|
channel_page, '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(
|
return self.url_result(
|
||||||
|
|
Loading…
Reference in a new issue