From 21a3434850879f2b75f81ac43fc418e5f0548090 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Sun, 2 Aug 2026 16:20:43 -0400 Subject: [PATCH] fix: skip non comment `commentFilterContextViewModel` key in comments (#5870) Some YouTube videos like https://www.youtube.com/watch?v=Ajkr_Wg-k8g had an non comment key that was inside the Array that contained some comment information that Invidious parses (like comment_key and toolbar_key), that being the `commentFilterContextViewModel` key, which is just an indicator on how comments are sorted: ``` { "commentThreadRenderer": { ... } <- comment information that is handled by line 134 of youtube.cr }, { "commentFilterContextViewModel": { "text": { "content": "Top is selected, so you'll see featured comments" }, "accessibility": { "accessibilityData": { "label": "Top is selected, so you'll see featured comments" } } } <- Useless information, this is not a comment } ``` --- src/invidious/comments/youtube.cr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/invidious/comments/youtube.cr b/src/invidious/comments/youtube.cr index 415c327c..134a3d71 100644 --- a/src/invidious/comments/youtube.cr +++ b/src/invidious/comments/youtube.cr @@ -128,6 +128,8 @@ module Invidious::Comments json.field "comments" do json.array do contents.as_a.each do |node| + next if node["commentFilterContextViewModel"]? + json.object do if node["commentThreadRenderer"]? node = node["commentThreadRenderer"]