mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
[youtube] get mix playlist title from ytInitialData
This commit is contained in:
parent
5c15c1a0d7
commit
15f6397c19
@ -2825,6 +2825,7 @@ def _extract_mix(self, playlist_id):
|
|||||||
# The mixes are generated from a single video
|
# The mixes are generated from a single video
|
||||||
# the id of the playlist is just 'RD' + video_id
|
# the id of the playlist is just 'RD' + video_id
|
||||||
ids = []
|
ids = []
|
||||||
|
yt_initial = None
|
||||||
last_id = playlist_id[-11:]
|
last_id = playlist_id[-11:]
|
||||||
for n in itertools.count(1):
|
for n in itertools.count(1):
|
||||||
url = 'https://www.youtube.com/watch?v=%s&list=%s' % (last_id, playlist_id)
|
url = 'https://www.youtube.com/watch?v=%s&list=%s' % (last_id, playlist_id)
|
||||||
@ -2858,6 +2859,9 @@ def _extract_mix(self, playlist_id):
|
|||||||
or search_title('title'))
|
or search_title('title'))
|
||||||
title = clean_html(title_span)
|
title = clean_html(title_span)
|
||||||
|
|
||||||
|
if not title:
|
||||||
|
title = try_get(yt_initial, lambda x: x['contents']['twoColumnWatchNextResults']['playlist']['playlist']['title'], compat_str)
|
||||||
|
|
||||||
return self.playlist_result(url_results, playlist_id, title)
|
return self.playlist_result(url_results, playlist_id, title)
|
||||||
|
|
||||||
def _extract_playlist(self, playlist_id):
|
def _extract_playlist(self, playlist_id):
|
||||||
|
Loading…
Reference in New Issue
Block a user