diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-02-25 15:55:23 -0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-02-26 11:39:23 -0500 |
commit | 00ef1c862744ec00886bc3fa4b95fdfc6c151866 (patch) | |
tree | bac6025f0e09df7d1fc65665eaef429407bf1391 /youtube/yt_data_extract/everything_else.py | |
parent | f26c9be85e1ac78d30954b3aa38c119bef415579 (diff) | |
download | yt-local-00ef1c862744ec00886bc3fa4b95fdfc6c151866.tar.lz yt-local-00ef1c862744ec00886bc3fa4b95fdfc6c151866.tar.xz yt-local-00ef1c862744ec00886bc3fa4b95fdfc6c151866.zip |
Fix comment replies
Comment reply protobuf now requires the channel id of the uploader
of the video. Otherwise the endpoint returns 500.
Instead of making the protobuf ourselves and passing this data
around through query parameters, just use the ctoken provided to us
but modify the max_replies field from 10 to 250.
Fixes #53
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.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py index ae8715f..197cf88 100644 --- a/youtube/yt_data_extract/everything_else.py +++ b/youtube/yt_data_extract/everything_else.py @@ -251,13 +251,19 @@ def extract_comments_info(polymer_json): info['video_title'] = extract_str(comment_thread.get('commentTargetTitle')) if 'replies' not in comment_thread: comment_info['reply_count'] = 0 + comment_info['reply_ctoken'] = None else: comment_info['reply_count'] = extract_int(deep_get(comment_thread, 'replies', 'commentRepliesRenderer', 'moreText' ), default=1) # With 1 reply, the text reads "View reply" + comment_info['reply_ctoken'] = deep_get(comment_thread, + 'replies', 'commentRepliesRenderer', 'continuations', 0, + 'nextContinuationData', 'continuation' + ) comment_renderer = deep_get(comment_thread, 'comment', 'commentRenderer', default={}) elif 'commentRenderer' in comment: # replies comment_info['reply_count'] = 0 # replyCount, below, not present for replies even if the reply has further replies to it + comment_info['reply_ctoken'] = None conservative_update(info, 'is_replies', True) comment_renderer = comment['commentRenderer'] else: |