This commit is contained in:
Giuseppe Lumia 2020-10-23 20:41:56 +05:30 committed by GitHub
commit e758a4cf07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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')
entries = result['entries']
self.assertTrue(len(entries) >= 50)
original_video = entries[0]
self.assertEqual(original_video['id'], 'OQpdSVF_k_w')
original_video_id = 'OQpdSVF_k_w'
self.assertTrue(original_video_id in {entry['id'] for entry in entries})
def test_youtube_toptracks(self):
print('Skipping: The playlist page gives error 500')

View File

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