Fix for videos that don't have 'captionTracks'

pull/100/head
Omar Roth 2018-08-06 20:03:10 -05:00
rodzic d2d5de55c1
commit baf4e7984b
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

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