From 481b4ecf5865c233a9f37d5f9e0a8ecc332f3831 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 10 Apr 2020 13:25:40 -0700 Subject: Do not hide comments if false determination of disabled comments If the extraction from watch page determines that they are disabled, but the separate request for the comments found comments, then change that determination, with a warning (since that would be a bug). And set the comment count to None as a dirty way to make such a bug noticeable. --- youtube/watch.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'youtube') diff --git a/youtube/watch.py b/youtube/watch.py index 2440729..b0b60b9 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -409,6 +409,15 @@ def get_watch_page(video_id=None): # 1 second per pixel, or the actual video width theater_video_target_width = max(640, info['duration'] or 0, video_width) + # 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: + info['comments_disabled'] = False + print('Warning: False determination that comments are disabled') + print('Comment count:', info['comment_count']) + info['comment_count'] = None # hack to make it obvious there's a bug + return flask.render_template('watch.html', header_playlist_names = local_playlist.get_playlist_names(), uploader_channel_url = ('/' + info['author_url']) if info['author_url'] else '', -- cgit v1.2.3