0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-22 02:15:12 +00:00

[youtube:tab] Support youtube music MP pages

This commit is contained in:
pukkandan 2021-05-17 18:37:58 +05:30
parent 18db754858
commit abcdd12b26
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -2926,6 +2926,14 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
'Falling back to channel URL', 'Falling back to channel URL',
], ],
'playlist_mincount': 9, 'playlist_mincount': 9,
}, {
'note': 'Youtube music Album',
'url': 'https://music.youtube.com/browse/MPREb_gTAcphH99wE',
'info_dict': {
'id': 'OLAK5uy_l1m0thk3g31NmIIz_vMIbWtyv7eZixlH0',
'title': 'Album - Royalty Free Music Library V2 (50 Songs)',
},
'playlist_count': 50,
}] }]
@classmethod @classmethod
@ -3633,6 +3641,13 @@ def get_mobj(url):
# Youtube music VL channels have an equivalent playlist # Youtube music VL channels have an equivalent playlist
item_id = item_id[2:] item_id = item_id[2:]
pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
elif item_id[:2] == 'MP':
# Youtube music albums (/channel/MP...) have a OLAK playlist that can be extracted from the webpage
item_id = self._search_regex(
r'\\x22audioPlaylistId\\x22:\\x22([0-9A-Za-z_-]+)\\x22',
self._download_webpage('https://music.youtube.com/channel/%s' % item_id, item_id),
'playlist id')
pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
elif mobj['channel_type'] == 'browse': elif mobj['channel_type'] == 'browse':
# Youtube music /browse/ should be changed to /channel/ # Youtube music /browse/ should be changed to /channel/
pre = 'https://www.youtube.com/channel/%s' % item_id pre = 'https://www.youtube.com/channel/%s' % item_id