From 4436359d0783ca8444467603a820c02372be7e9f Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 28 Nov 2021 23:44:37 +0100 Subject: [PATCH] Use dig to get category contents Co-authored-by: Matthew McGarvey --- src/invidious/videos.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index c9f6626a..db94110b 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -954,7 +954,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ contents = row.dig?("metadataRowRenderer", "contents", 0) if title.try &.== "Category" - contents = contents.try &.["runs"]?.try &.as_a[0]? + contents = contents.try &.dig?("runs", 0) params["genre"] = JSON::Any.new(contents.try &.["text"]?.try &.as_s || "") params["genreUcid"] = JSON::Any.new(contents.try &.["navigationEndpoint"]?.try &.["browseEndpoint"]?