1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 02:14:32 +01:00

[youtube] Fix youtube mix playlist extraction (closes #26390)

This commit is contained in:
Giuseppe Lumia 2020-09-06 20:50:48 +02:00
parent d51e23d9fc
commit 483056d624
No known key found for this signature in database
GPG Key ID: 271ECF56EA002788
2 changed files with 3 additions and 4 deletions

View File

@ -45,8 +45,8 @@ class TestYoutubeLists(unittest.TestCase):
result = ie.extract('https://www.youtube.com/watch?v=W01L70IGBgE&index=2&list=RDOQpdSVF_k_w') result = ie.extract('https://www.youtube.com/watch?v=W01L70IGBgE&index=2&list=RDOQpdSVF_k_w')
entries = result['entries'] entries = result['entries']
self.assertTrue(len(entries) >= 50) self.assertTrue(len(entries) >= 50)
original_video = entries[0] original_video_id = 'OQpdSVF_k_w'
self.assertEqual(original_video['id'], 'OQpdSVF_k_w') self.assertTrue(original_video_id in {entry['id'] for entry in entries})
def test_youtube_toptracks(self): def test_youtube_toptracks(self):
print('Skipping: The playlist page gives error 500') print('Skipping: The playlist page gives error 500')

View File

@ -2781,8 +2781,7 @@ class YoutubePlaylistIE(YoutubePlaylistBaseInfoExtractor):
webpage = self._download_webpage( webpage = self._download_webpage(
url, playlist_id, 'Downloading page {0} of Youtube mix'.format(n)) url, playlist_id, 'Downloading page {0} of Youtube mix'.format(n))
new_ids = orderedSet(re.findall( new_ids = orderedSet(re.findall(
r'''(?xs)data-video-username=".*?".*? r'[\'"]/watch\?v=([0-9A-Za-z_-]{11})(?:&|\\u0026)[^"]*?list=%s' % re.escape(playlist_id),
href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id),
webpage)) webpage))
# Fetch new pages until all the videos are repeated, it seems that # Fetch new pages until all the videos are repeated, it seems that
# there are always 51 unique videos. # there are always 51 unique videos.