diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-12-18 19:39:16 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-12-18 19:39:16 -0800 |
commit | 98777ee82561ae205f156a7f8497728aecfa080c (patch) | |
tree | aaaf3e82dcdac00abda588b6cfb15e5382a49cd0 /youtube/comments.py | |
parent | ee0a118a6c7ed0e371fed18dcdace1f18a3cabf6 (diff) | |
download | yt-local-98777ee82561ae205f156a7f8497728aecfa080c.tar.lz yt-local-98777ee82561ae205f156a7f8497728aecfa080c.tar.xz yt-local-98777ee82561ae205f156a7f8497728aecfa080c.zip |
Extraction: Rewrite item_extraction for better error handling and readability, rename extracted names for more consistency
Diffstat (limited to 'youtube/comments.py')
-rw-r--r-- | youtube/comments.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/youtube/comments.py b/youtube/comments.py index 250a95f..e237f0f 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -91,33 +91,33 @@ def post_process_comments_info(comments_info): comment['author_url'] = util.URL_ORIGIN + comment['author_url'] comment['author_avatar'] = '/' + comment['author_avatar'] - comment['permalink'] = util.URL_ORIGIN + '/watch?v=' + comments_info['video_id'] + '&lc=' + comment['comment_id'] + comment['permalink'] = util.URL_ORIGIN + '/watch?v=' + comments_info['video_id'] + '&lc=' + comment['id'] if comment['author_channel_id'] in accounts.accounts: comment['delete_url'] = (util.URL_ORIGIN + '/delete_comment?video_id=' + comments_info['video_id'] + '&channel_id='+ comment['author_channel_id'] + '&author_id=' + comment['author_id'] - + '&comment_id=' + comment['comment_id']) + + '&comment_id=' + comment['id']) - num_replies = comment['number_of_replies'] - if num_replies == 0: - comment['replies_url'] = util.URL_ORIGIN + '/post_comment?parent_id=' + comment['comment_id'] + "&video_id=" + comments_info['video_id'] + reply_count = comment['reply_count'] + if reply_count == 0: + comment['replies_url'] = util.URL_ORIGIN + '/post_comment?parent_id=' + comment['id'] + "&video_id=" + comments_info['video_id'] else: - comment['replies_url'] = util.URL_ORIGIN + '/comments?parent_id=' + comment['comment_id'] + "&video_id=" + comments_info['video_id'] + comment['replies_url'] = util.URL_ORIGIN + '/comments?parent_id=' + comment['id'] + "&video_id=" + comments_info['video_id'] - if num_replies == 0: + if reply_count == 0: comment['view_replies_text'] = 'Reply' - elif num_replies == 1: + elif reply_count == 1: comment['view_replies_text'] = '1 reply' else: - comment['view_replies_text'] = str(num_replies) + ' replies' + comment['view_replies_text'] = str(reply_count) + ' replies' - if comment['likes'] == 1: + if comment['like_count'] == 1: comment['likes_text'] = '1 like' else: - comment['likes_text'] = str(comment['likes']) + ' likes' + comment['likes_text'] = str(comment['like_count']) + ' likes' comments_info['include_avatars'] = settings.enable_comment_avatars if comments_info['ctoken']: |