Add fix for videos that don't have captions

このコミットが含まれているのは:
Omar Roth 2018-07-22 11:41:08 -05:00
コミット f4160f937c
1個のファイルの変更2行の追加3行の削除

ファイルの表示

@ -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")