aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-03-02 18:54:22 -0800
committerJesús <heckyel@hyperbola.info>2021-03-03 10:40:02 -0500
commit2df42389246bd731e04bd2e2472a05d27917b981 (patch)
tree92c683efee4537875be547fad044eab5c8d2e1e0 /youtube/yt_data_extract
parentc45f60d3f5914d7924e9940c504bd3443f2eb8de (diff)
downloadyt-local-2df42389246bd731e04bd2e2472a05d27917b981.tar.lz
yt-local-2df42389246bd731e04bd2e2472a05d27917b981.tar.xz
yt-local-2df42389246bd731e04bd2e2472a05d27917b981.zip
Use new channel api endpoint now that browse_ajax is disabled
Fixes channel pages > 1 Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/common.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube/yt_data_extract/common.py b/youtube/yt_data_extract/common.py
index 5feda87..57a84ed 100644
--- a/youtube/yt_data_extract/common.py
+++ b/youtube/yt_data_extract/common.py
@@ -339,6 +339,11 @@ def extract_item_info(item, additional_info={}):
def extract_response(polymer_json):
'''return response, error'''
+ # /youtubei/v1/browse endpoint returns response directly
+ if isinstance(polymer_json, dict) and 'responseContext' in polymer_json:
+ # this is the response
+ return polymer_json, None
+
response = multi_deep_get(polymer_json, [1, 'response'], ['response'])
if response is None:
return None, 'Failed to extract response'