From baf4e7984ba91e01104a72140db0b05a48086495 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 6 Aug 2018 20:03:10 -0500 Subject: [PATCH] Fix for videos that don't have 'captionTracks' --- src/invidious/videos.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index a4b96799..346b60b6 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -167,7 +167,8 @@ class Video captions = [] of Caption if player_response["captions"]? - caption_list = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"].as_a + caption_list = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a + caption_list ||= [] of JSON::Any caption_list.each do |caption| caption = Caption.from_json(caption.to_json)