aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract/everything_else.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-08-07 17:05:58 -0700
committerJesús <heckyel@hyperbola.info>2021-08-09 12:10:42 -0500
commit3dee7ea0d1156642d02f504b9229676b287ddf0a (patch)
tree76770d1aacfac266613ed32b18bee8329d413d71 /youtube/yt_data_extract/everything_else.py
parentbee14ea9ea2a3e78f70b1a68c965d15297a6ede8 (diff)
downloadyt-local-3dee7ea0d1156642d02f504b9229676b287ddf0a.tar.lz
yt-local-3dee7ea0d1156642d02f504b9229676b287ddf0a.tar.xz
yt-local-3dee7ea0d1156642d02f504b9229676b287ddf0a.zip
Switch to new comments api now that old one is being disabled
watch_comment api periodically gives the error "Top level comments mweb servlet is turned down." The continuation items for the new api are in a different arrangement in the json, so changes were necessary to the extract_items function. Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/yt_data_extract/everything_else.py')
-rw-r--r--youtube/yt_data_extract/everything_else.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index 7275975..ba3cd77 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -222,15 +222,13 @@ def _ctoken_metadata(ctoken):
result['sort'] = 0
return result
-def extract_comments_info(polymer_json):
+def extract_comments_info(polymer_json, ctoken=None):
response, err = extract_response(polymer_json)
if err:
return {'error': err}
info = {'error': None}
- url = multi_deep_get(polymer_json, [1, 'url'], ['url'])
- if url:
- ctoken = urllib.parse.parse_qs(url[url.find('?')+1:])['ctoken'][0]
+ if ctoken:
metadata = _ctoken_metadata(ctoken)
else:
metadata = {}