aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-04-10 13:25:40 -0700
committerJames Taylor <user234683@users.noreply.github.com>2020-04-10 13:25:40 -0700
commit481b4ecf5865c233a9f37d5f9e0a8ecc332f3831 (patch)
tree8c2b62c20f838644596f292c77068a90da84324e /youtube
parent1224dd88a387d23d7a908aa79b5de0debb51c8cd (diff)
downloadyt-local-481b4ecf5865c233a9f37d5f9e0a8ecc332f3831.tar.lz
yt-local-481b4ecf5865c233a9f37d5f9e0a8ecc332f3831.tar.xz
yt-local-481b4ecf5865c233a9f37d5f9e0a8ecc332f3831.zip
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.
Diffstat (limited to 'youtube')
-rw-r--r--youtube/watch.py9
1 files changed, 9 insertions, 0 deletions
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 '',