From d67d032aa27bf024451ac42ba868dcc236b36965 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 6 Sep 2023 12:28:22 -0700 Subject: [PATCH] Update comment detection to not use msg renderer --- src/invidious/videos/parser.cr | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 27501868e..f39f2a362 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -296,16 +296,14 @@ module Invidious::Videos::Parser ) # Comments enabled? - comments_enabled = true + comments_enabled = false - # When comments are enabled the primary results should contain either the comments-entry-point - # or comment-item-section section + # When comments are enabled there should be a comments-entry-point section in the primary results if primary_results - section = primary_results.as_a.find { |s| s.dig?("itemSectionRenderer", "sectionIdentifier") == "comment-item-section" } + section = primary_results.as_a.find { |s| s.dig?("itemSectionRenderer", "sectionIdentifier") == "comments-entry-point" } - # messageRenderer should say "Comments are turned off." - if section && section.dig?("itemSectionRenderer", "contents", 0, "messageRenderer") - comments_enabled = false + if section + comments_enabled = true end end