mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 17:02:30 +00:00
[youtube] Fix multifeed extraction (closes #18531)
This commit is contained in:
parent
0a05cfabb6
commit
8fe104947d
@ -1712,30 +1712,36 @@ def replace_url(m):
|
|||||||
else:
|
else:
|
||||||
video_description = ''
|
video_description = ''
|
||||||
|
|
||||||
if 'multifeed_metadata_list' in video_info and not smuggled_data.get('force_singlefeed', False):
|
if not smuggled_data.get('force_singlefeed', False):
|
||||||
if not self._downloader.params.get('noplaylist'):
|
if not self._downloader.params.get('noplaylist'):
|
||||||
entries = []
|
multifeed_metadata_list = try_get(
|
||||||
feed_ids = []
|
player_response,
|
||||||
multifeed_metadata_list = video_info['multifeed_metadata_list'][0]
|
lambda x: x['multicamera']['playerLegacyMulticameraRenderer']['metadataList'],
|
||||||
for feed in multifeed_metadata_list.split(','):
|
compat_str) or try_get(
|
||||||
# Unquote should take place before split on comma (,) since textual
|
video_info, lambda x: x['multifeed_metadata_list'][0], compat_str)
|
||||||
# fields may contain comma as well (see
|
if multifeed_metadata_list:
|
||||||
# https://github.com/rg3/youtube-dl/issues/8536)
|
entries = []
|
||||||
feed_data = compat_parse_qs(compat_urllib_parse_unquote_plus(feed))
|
feed_ids = []
|
||||||
entries.append({
|
for feed in multifeed_metadata_list.split(','):
|
||||||
'_type': 'url_transparent',
|
# Unquote should take place before split on comma (,) since textual
|
||||||
'ie_key': 'Youtube',
|
# fields may contain comma as well (see
|
||||||
'url': smuggle_url(
|
# https://github.com/rg3/youtube-dl/issues/8536)
|
||||||
'%s://www.youtube.com/watch?v=%s' % (proto, feed_data['id'][0]),
|
feed_data = compat_parse_qs(compat_urllib_parse_unquote_plus(feed))
|
||||||
{'force_singlefeed': True}),
|
entries.append({
|
||||||
'title': '%s (%s)' % (video_title, feed_data['title'][0]),
|
'_type': 'url_transparent',
|
||||||
})
|
'ie_key': 'Youtube',
|
||||||
feed_ids.append(feed_data['id'][0])
|
'url': smuggle_url(
|
||||||
self.to_screen(
|
'%s://www.youtube.com/watch?v=%s' % (proto, feed_data['id'][0]),
|
||||||
'Downloading multifeed video (%s) - add --no-playlist to just download video %s'
|
{'force_singlefeed': True}),
|
||||||
% (', '.join(feed_ids), video_id))
|
'title': '%s (%s)' % (video_title, feed_data['title'][0]),
|
||||||
return self.playlist_result(entries, video_id, video_title, video_description)
|
})
|
||||||
self.to_screen('Downloading just video %s because of --no-playlist' % video_id)
|
feed_ids.append(feed_data['id'][0])
|
||||||
|
self.to_screen(
|
||||||
|
'Downloading multifeed video (%s) - add --no-playlist to just download video %s'
|
||||||
|
% (', '.join(feed_ids), video_id))
|
||||||
|
return self.playlist_result(entries, video_id, video_title, video_description)
|
||||||
|
else:
|
||||||
|
self.to_screen('Downloading just video %s because of --no-playlist' % video_id)
|
||||||
|
|
||||||
if view_count is None:
|
if view_count is None:
|
||||||
view_count = extract_view_count(video_info)
|
view_count = extract_view_count(video_info)
|
||||||
|
Loading…
Reference in New Issue
Block a user