mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 17:22:31 +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',
|
'uploader_id': 'UCKfVa3S1e4PHvxWcwyMMg8w',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 12,
|
'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',
|
'url': 'https://invidio.us/channel/UCmlqkdCBesrv2Lak1mF_MxA',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -3234,8 +3245,9 @@ def extract_entries(parent_renderer): # this needs to called again for continua
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _extract_selected_tab(tabs):
|
def _extract_selected_tab(tabs):
|
||||||
for tab in tabs:
|
for tab in tabs:
|
||||||
if try_get(tab, lambda x: x['tabRenderer']['selected'], bool):
|
renderer = dict_get(tab, ('tabRenderer', 'expandableTabRenderer')) or {}
|
||||||
return tab['tabRenderer']
|
if renderer.get('selected') is True:
|
||||||
|
return renderer
|
||||||
else:
|
else:
|
||||||
raise ExtractorError('Unable to find selected tab')
|
raise ExtractorError('Unable to find selected tab')
|
||||||
|
|
||||||
@ -3309,6 +3321,7 @@ def _extract_from_tabs(self, item_id, webpage, data, tabs):
|
|||||||
try_get(data, lambda x: x['header']['hashtagHeaderRenderer']['hashtag']['simpleText'])
|
try_get(data, lambda x: x['header']['hashtagHeaderRenderer']['hashtag']['simpleText'])
|
||||||
or playlist_id)
|
or playlist_id)
|
||||||
title += format_field(selected_tab, 'title', ' - %s')
|
title += format_field(selected_tab, 'title', ' - %s')
|
||||||
|
title += format_field(selected_tab, 'expandedText', ' - %s')
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
'playlist_id': playlist_id,
|
'playlist_id': playlist_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user