aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-06-09 15:58:28 -0700
committerJesús <heckyel@hyperbola.info>2021-06-10 12:47:09 -0500
commita9edc54aac43ce37ea6982aeb28c4e0552b6b91d (patch)
tree452f08d0ca80665c7a0c1448814ef1e1f6fa7448 /youtube
parent9077596979843dd136ff96fec0d704d097949a34 (diff)
downloadyt-local-a9edc54aac43ce37ea6982aeb28c4e0552b6b91d.tar.lz
yt-local-a9edc54aac43ce37ea6982aeb28c4e0552b6b91d.tar.xz
yt-local-a9edc54aac43ce37ea6982aeb28c4e0552b6b91d.zip
Use extract_approx_int for comment likes
Full digits no longer available Closes #64 Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube')
-rw-r--r--youtube/comments.py5
-rw-r--r--youtube/templates/comments.html2
-rw-r--r--youtube/yt_data_extract/everything_else.py4
3 files changed, 6 insertions, 5 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index d47c826..208c161 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -118,10 +118,11 @@ def post_process_comments_info(comments_info):
else:
comment['view_replies_text'] = str(reply_count) + ' replies'
- if comment['like_count'] == 1:
+ if comment['approx_like_count'] == '1':
comment['likes_text'] = '1 like'
else:
- comment['likes_text'] = str(comment['like_count']) + ' likes'
+ comment['likes_text'] = (str(comment['approx_like_count'])
+ + ' likes')
comments_info['include_avatars'] = settings.enable_comment_avatars
if comments_info['ctoken']:
diff --git a/youtube/templates/comments.html b/youtube/templates/comments.html
index 7d0ef85..7bd75e5 100644
--- a/youtube/templates/comments.html
+++ b/youtube/templates/comments.html
@@ -21,7 +21,7 @@
<span class="comment-text">{{ common_elements.text_runs(comment['text']) }}</span>
{% endif %}
- <span class="comment-likes">{{ comment['likes_text'] if comment['like_count'] else ''}}</span>
+ <span class="comment-likes">{{ comment['likes_text'] if comment['approx_like_count'] else ''}}</span>
<div class="button-row">
{% if comment['reply_count'] %}
{% if settings.use_comments_js and comment['replies_url'] %}
diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py
index f39de90..7275975 100644
--- a/youtube/yt_data_extract/everything_else.py
+++ b/youtube/yt_data_extract/everything_else.py
@@ -284,8 +284,8 @@ def extract_comments_info(polymer_json):
comment_info['text'] = extract_formatted_text(comment_renderer.get('contentText'))
comment_info['time_published'] = extract_str(comment_renderer.get('publishedTimeText'))
comment_info['like_count'] = comment_renderer.get('likeCount')
- liberal_update(comment_info, 'like_count',
- extract_int(comment_renderer.get('voteCount')))
+ comment_info['approx_like_count'] = extract_approx_int(
+ comment_renderer.get('voteCount'))
liberal_update(comment_info, 'reply_count', comment_renderer.get('replyCount'))
info['comments'].append(comment_info)