aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/comments.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/comments.py')
-rw-r--r--youtube/comments.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index 92a89e1..1ff1a21 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -53,7 +53,7 @@ def request_comments(ctoken, replies=False):
'hl': 'en',
'gl': 'US',
'clientName': 'MWEB',
- 'clientVersion': '2.20240328.08.00',
+ 'clientVersion': '2.20210804.02.00',
},
},
'continuation': ctoken.replace('=', '%3D'),
@@ -78,7 +78,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'] = strip_non_ascii(comment['author']) if comment.get('author') else ""
comment['author_url'] = concat_or_none(
'/', comment['author_url'])
comment['author_avatar'] = concat_or_none(
@@ -189,10 +189,10 @@ def video_comments(video_id, sort=0, offset=0, lc='', secret_key=''):
comments_info['error'] += '\n\n' + e.error_message
comments_info['error'] += '\n\nExit node IP address: %s' % e.ip
else:
- comments_info['error'] = 'YouTube blocked the request. IP address: %s' % e.ip
+ comments_info['error'] = 'YouTube blocked the request. Error: %s' % str(e)
except Exception as e:
- comments_info['error'] = 'YouTube blocked the request. IP address: %s' % e.ip
+ comments_info['error'] = 'YouTube blocked the request. Error: %s' % str(e)
if comments_info.get('error'):
print('Error retrieving comments for ' + str(video_id) + ':\n' +