From d4e94cb1105db9d2645aeddae12a02825d0c98c4 Mon Sep 17 00:00:00 2001 From: Ben Bryant Date: Sun, 19 Apr 2020 20:53:06 -0700 Subject: [PATCH] Account for failure to find "textTracks" --- youtube_dl/extractor/funimation.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/funimation.py b/youtube_dl/extractor/funimation.py index 979e0fee8..f3bf6ca02 100644 --- a/youtube_dl/extractor/funimation.py +++ b/youtube_dl/extractor/funimation.py @@ -164,11 +164,12 @@ class FunimationIE(InfoExtractor): player_page, 'player data', default='') text_tracks_search = '{' + text_tracks_search + '}' player_json = self._parse_json(text_tracks_search, display_id, js_to_json, fatal=False) or {} + text_tracks = player_json.get('textTracks', []) subtitles = {} - for x in player_json['textTracks']: - data = {'url': x['src']} - if x['language'] in subtitles: - subtitles[x['language']].append(data) + for text_track in text_tracks: + data = {'url': text_track['src']} + if text_track['language'] in subtitles: + subtitles[text_track['language']].append(data) else: - subtitles[x['language']] = [data] + subtitles[text_track['language']] = [data] return subtitles