mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 20:59:24 +01:00
[youtube:tab] Support channel search
Fixes: https://github.com/ytdl-org/youtube-dl/issues/29071
This commit is contained in:
parent
da692b7920
commit
cd684175ad
@ -2666,6 +2666,17 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
||||
'uploader_id': 'UCKfVa3S1e4PHvxWcwyMMg8w',
|
||||
},
|
||||
'playlist_mincount': 12,
|
||||
}, {
|
||||
'note': 'Search tab',
|
||||
'url': 'https://www.youtube.com/c/3blue1brown/search?query=linear%20algebra',
|
||||
'playlist_mincount': 40,
|
||||
'info_dict': {
|
||||
'id': 'UCYO_jab_esuFRV4b17AJtAw',
|
||||
'title': '3Blue1Brown - Search - linear algebra',
|
||||
'description': 'md5:e1384e8a133307dd10edee76e875d62f',
|
||||
'uploader': '3Blue1Brown',
|
||||
'uploader_id': 'UCYO_jab_esuFRV4b17AJtAw',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://invidio.us/channel/UCmlqkdCBesrv2Lak1mF_MxA',
|
||||
'only_matching': True,
|
||||
@ -3234,8 +3245,9 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
||||
@staticmethod
|
||||
def _extract_selected_tab(tabs):
|
||||
for tab in tabs:
|
||||
if try_get(tab, lambda x: x['tabRenderer']['selected'], bool):
|
||||
return tab['tabRenderer']
|
||||
renderer = dict_get(tab, ('tabRenderer', 'expandableTabRenderer')) or {}
|
||||
if renderer.get('selected') is True:
|
||||
return renderer
|
||||
else:
|
||||
raise ExtractorError('Unable to find selected tab')
|
||||
|
||||
@ -3309,6 +3321,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
|
||||
try_get(data, lambda x: x['header']['hashtagHeaderRenderer']['hashtag']['simpleText'])
|
||||
or playlist_id)
|
||||
title += format_field(selected_tab, 'title', ' - %s')
|
||||
title += format_field(selected_tab, 'expandedText', ' - %s')
|
||||
|
||||
metadata = {
|
||||
'playlist_id': playlist_id,
|
||||
|
Loading…
Reference in New Issue
Block a user