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.
This commit is contained in:
James Taylor 2020-04-10 13:25:40 -07:00
parent 1224dd88a3
commit 481b4ecf58

View File

@ -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 '',