From e41180058f8d812d8d3c59e15f2e7d7b84eef808 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 21 Dec 2020 12:25:44 -0800 Subject: Fix exception when video comments disabled and blank comments info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e.g. happens on vid where comments are disabled if comments disabled in settings since the comments info object is just {} Signed-off-by: Jesús --- youtube/watch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'youtube/watch.py') diff --git a/youtube/watch.py b/youtube/watch.py index 7c140d9..78a404a 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -458,7 +458,7 @@ def get_watch_page(video_id=None): # Check for false determination of disabled comments, which comes from # the watch page. But if we got comments in the separate request for those, # then the determination is wrong. - if info['comments_disabled'] and len(comments_info['comments']) != 0: + if info['comments_disabled'] and comments_info.get('comments'): info['comments_disabled'] = False print('Warning: False determination that comments are disabled') print('Comment count:', info['comment_count']) -- cgit v1.2.3