diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-10-16 13:18:56 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-10-16 13:18:56 -0700 |
commit | 697d6e3583741faca197a238eac70710252d1ccb (patch) | |
tree | 69fb9b34d453a7c4988e25498124a22424d24269 | |
parent | dd800485f0646fbaf49b9c65aa18fc4d18c62c5b (diff) | |
download | yt-local-697d6e3583741faca197a238eac70710252d1ccb.tar.lz yt-local-697d6e3583741faca197a238eac70710252d1ccb.tar.xz yt-local-697d6e3583741faca197a238eac70710252d1ccb.zip |
fix error parsing comments when a comment has all replies in a thread
-rw-r--r-- | youtube/comments.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/youtube/comments.py b/youtube/comments.py index fe27001..c724f15 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -206,9 +206,9 @@ def parse_comments_polymer(content, replies=False): if 'commentTargetTitle' in comment_raw: video_title = comment_raw['commentTargetTitle']['runs'][0]['text'] if 'replies' in comment_raw: - reply_ctoken = comment_raw['replies']['commentRepliesRenderer']['continuations'][0]['nextContinuationData']['continuation'] - comment_id, video_id = get_ids(reply_ctoken) - replies_url = URL_ORIGIN + '/comments?parent_id=' + comment_id + "&video_id=" + video_id + #reply_ctoken = comment_raw['replies']['commentRepliesRenderer']['continuations'][0]['nextContinuationData']['continuation'] + #comment_id, video_id = get_ids(reply_ctoken) + # replies_url = URL_ORIGIN + '/comments?parent_id=' + comment_id + "&video_id=" + video_id view_replies_text = common.get_plain_text(comment_raw['replies']['commentRepliesRenderer']['moreText']) match = reply_count_regex.search(view_replies_text) if match is None: @@ -217,8 +217,8 @@ def parse_comments_polymer(content, replies=False): view_replies_text = match.group(1) + " replies" elif not replies: view_replies_text = "Reply" - parent_id = comment_raw['comment']['commentRenderer']['commentId'] - replies_url = URL_ORIGIN + '/post_comment?parent_id=' + parent_id + "&video_id=" + video_id + parent_id = comment_raw['comment']['commentRenderer']['commentId'] + replies_url = URL_ORIGIN + '/post_comment?parent_id=' + parent_id + "&video_id=" + video_id comment_raw = comment_raw['comment'] comment_raw = comment_raw['commentRenderer'] |