From f4160f937ca3b8ade6937864bb277d01cea21422 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 22 Jul 2018 11:41:08 -0500 Subject: [PATCH] Add fix for videos that don't have captions --- src/invidious.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 5a0853f4..c4791976 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -353,10 +353,9 @@ get "/watch" do |env| player_response = JSON.parse(video.info["player_response"]) if player_response["captions"]? - captions = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"].as_a - else - captions = [] of JSON::Any + captions = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a end + captions ||= [] of JSON::Any rvs = [] of Hash(String, String) if video.info.has_key?("rvs")