From 4119cecf75881c60e72935c99833896ee9adaa9d Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Sun, 22 Oct 2023 19:09:02 -0400 Subject: [PATCH] simplify check for continuationItemRenderer Co-Authored-By: syeopite <70992037+syeopite@users.noreply.github.com> Co-Authored-By: Samantaz Fox --- src/invidious/yt_backend/extractors.cr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index f8819fbf..ae8679e0 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -717,14 +717,14 @@ private module Extractors end private def self.extract(target) - raw_items = [] of Array(JSON::Any) + raw_items = [] of JSON::Any target.dig("primaryContents", "sectionListRenderer", "contents").as_a.each do |node| if new_node = node["itemSectionRenderer"]? - raw_items << new_node["contents"].as_a - end - if node["continuationItemRenderer"]? - raw_items.push([node]) + raw_items += new_node["contents"].as_a + elsif node["continuationItemRenderer"]? + # we put the node in an array so the ContinuationItemRendererParser is able to parse it + raw_items << node end end