From b49b5fbda90a7fc9923af27a870504be976d55e9 Mon Sep 17 00:00:00 2001 From: syeopite Date: Wed, 13 Oct 2021 11:32:27 -0700 Subject: [PATCH] Support empty categories --- src/invidious/helpers/extractors.cr | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/invidious/helpers/extractors.cr b/src/invidious/helpers/extractors.cr index c8a6cd4a..73b07fd2 100644 --- a/src/invidious/helpers/extractors.cr +++ b/src/invidious/helpers/extractors.cr @@ -321,11 +321,13 @@ private module Parsers content_container = item_contents["contents"] end - raw_contents = content_container["items"].as_a - raw_contents.each do |item| - result = extract_item(item) - if !result.nil? - contents << result + raw_contents = content_container["items"]?.try &.as_a + if !raw_contents.nil? + raw_contents.each do |item| + result = extract_item(item) + if !result.nil? + contents << result + end end end