From 056c3be3f2ab9a19d8b2c38396826aaad9d4081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Wed, 30 Dec 2020 00:04:41 -0500 Subject: strip_non_ascii in comments-author-name --- youtube/comments.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'youtube/comments.py') diff --git a/youtube/comments.py b/youtube/comments.py index fff7cb5..8ab2b2c 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -1,5 +1,8 @@ from youtube import proto, util, yt_data_extract -from youtube.util import concat_or_none +from youtube.util import ( + concat_or_none, + strip_non_ascii +) from youtube import yt_app import settings @@ -88,6 +91,7 @@ def single_comment_ctoken(video_id, comment_id): def post_process_comments_info(comments_info): for comment in comments_info['comments']: + comment['author'] = strip_non_ascii(comment['author']) comment['author_url'] = concat_or_none( '/', comment['author_url']) comment['author_avatar'] = concat_or_none( @@ -114,7 +118,6 @@ def post_process_comments_info(comments_info): else: comment['view_replies_text'] = str(reply_count) + ' replies' - if comment['like_count'] == 1: comment['likes_text'] = '1 like' else: -- cgit v1.2.3