From 84c6192e08617c166065bbc6b91ecb7f9217f5e2 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 21 Dec 2020 12:44:00 -0800 Subject: video_comments: print error string in console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jesús --- youtube/comments.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'youtube') diff --git a/youtube/comments.py b/youtube/comments.py index fc353f9..c19a70a 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -179,7 +179,6 @@ def video_comments(video_id, sort=0, offset=0, lc='', secret_key=''): else: return {} except util.FetchError as e: - print('Error retrieving comments for ' + str(video_id)) if e.code == '429' and settings.route_tor: comments_info['error'] = 'Error: Youtube blocked the request because the Tor exit node is overutilized.' if e.error_message: @@ -189,9 +188,12 @@ def video_comments(video_id, sort=0, offset=0, lc='', secret_key=''): comments_info['error'] = traceback.format_exc() except Exception as e: - print('Error retrieving comments for ' + str(video_id)) comments_info['error'] = traceback.format_exc() + if comments_info.get('error'): + print('Error retrieving comments for ' + str(video_id) + ':\n' + + comments_info['error']) + return comments_info -- cgit v1.2.3