From 1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 10 Feb 2021 12:28:51 -0800 Subject: yt_data_ext: support richGrid&richItem sometimes used on search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some searches have these renderers instead of the usual ones Signed-off-by: Jesús --- youtube/yt_data_extract/common.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'youtube/yt_data_extract/common.py') diff --git a/youtube/yt_data_extract/common.py b/youtube/yt_data_extract/common.py index 1ec3dc3..5feda87 100644 --- a/youtube/yt_data_extract/common.py +++ b/youtube/yt_data_extract/common.py @@ -395,7 +395,8 @@ def _traverse_standard_list(renderer): nested_renderer_dispatch = { 'singleColumnBrowseResultsRenderer': _traverse_browse_renderer, 'twoColumnBrowseResultsRenderer': _traverse_browse_renderer, - 'twoColumnSearchResultsRenderer': lambda renderer: get(renderer, 'primaryContents', {}), + 'twoColumnSearchResultsRenderer': lambda r: get(r, 'primaryContents', {}), + 'richItemRenderer': lambda r: get(r, 'content', {}), } # these renderers contain a list of renderers inside them @@ -403,6 +404,7 @@ nested_renderer_list_dispatch = { 'sectionListRenderer': _traverse_standard_list, 'itemSectionRenderer': _traverse_standard_list, 'gridRenderer': _traverse_standard_list, + 'richGridRenderer': _traverse_standard_list, 'playlistVideoListRenderer': _traverse_standard_list, 'singleColumnWatchNextResults': lambda r: (deep_get(r, 'results', 'results', 'contents', default=[]), None), } -- cgit v1.2.3