mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-04 14:22:04 +00:00
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 } ```
This commit is contained in:
@@ -128,6 +128,8 @@ module Invidious::Comments
|
|||||||
json.field "comments" do
|
json.field "comments" do
|
||||||
json.array do
|
json.array do
|
||||||
contents.as_a.each do |node|
|
contents.as_a.each do |node|
|
||||||
|
next if node["commentFilterContextViewModel"]?
|
||||||
|
|
||||||
json.object do
|
json.object do
|
||||||
if node["commentThreadRenderer"]?
|
if node["commentThreadRenderer"]?
|
||||||
node = node["commentThreadRenderer"]
|
node = node["commentThreadRenderer"]
|
||||||
|
|||||||
Reference in New Issue
Block a user