mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-08-18 21:30:44 +02:00
[youtube:playlist] Fix mixes extraction (fixes #2444)
This commit is contained in:
parent
f919201ecc
commit
bc2f773b4f
@ -1488,11 +1488,16 @@ def _extract_mix(self, playlist_id):
|
|||||||
# the id of the playlist is just 'RD' + video_id
|
# the id of the playlist is just 'RD' + video_id
|
||||||
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
url = 'https://youtube.com/watch?v=%s&list=%s' % (playlist_id[-11:], playlist_id)
|
||||||
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
webpage = self._download_webpage(url, playlist_id, u'Downloading Youtube mix')
|
||||||
title_span = (get_element_by_attribute('class', 'title long-title', webpage) or
|
search_title = lambda class_name: get_element_by_attribute('class', class_name, webpage)
|
||||||
get_element_by_attribute('class', 'title ', webpage))
|
title_span = (search_title('playlist-title') or
|
||||||
|
search_title('title long-title') or search_title('title'))
|
||||||
title = clean_html(title_span)
|
title = clean_html(title_span)
|
||||||
video_re = r'data-index="\d+".*?href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s' % re.escape(playlist_id)
|
video_re = r'''(?x)data-index="\d+".*?
|
||||||
ids = orderedSet(re.findall(video_re, webpage))
|
data-video-username="(.*?)".*?
|
||||||
|
href="/watch\?v=([0-9A-Za-z_-]{11})&[^"]*?list=%s''' % re.escape(playlist_id)
|
||||||
|
matches = orderedSet(re.findall(video_re, webpage, flags=re.DOTALL))
|
||||||
|
# Some of the videos may have beend deleted, their username field is empty
|
||||||
|
ids = [video_id for (username, video_id) in matches if username]
|
||||||
url_results = self._ids_to_results(ids)
|
url_results = self._ids_to_results(ids)
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_id, title)
|
return self.playlist_result(url_results, playlist_id, title)
|
||||||
|
Loading…
Reference in New Issue
Block a user