aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-02-10 12:28:51 -0800
committerJesús <heckyel@hyperbola.info>2021-02-13 17:29:05 -0500
commit1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c (patch)
treebc1e905d84728acaa9dbe95c0f1feac6e5c87586 /youtube/yt_data_extract
parentdd5876e0c6583af69e37d33ee7976b648bdd209a (diff)
downloadyt-local-1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c.tar.lz
yt-local-1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c.tar.xz
yt-local-1cc0ffcb20e85eba8bfa2515936a149aa0a3f82c.zip
yt_data_ext: support richGrid&richItem sometimes used on search
Some searches have these renderers instead of the usual ones Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/common.py4
1 files changed, 3 insertions, 1 deletions
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),
}