Skip to content

Commit

Permalink
[brightcove] Fix subtitles extraction (closes #25540)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Jun 5, 2020
1 parent d5147b6 commit b4eb0bc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions youtube_dl/extractor/brightcove.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
int_or_none,
parse_iso8601,
smuggle_url,
str_or_none,
unescapeHTML,
unsmuggle_url,
update_url_query,
url_or_none,
clean_html,
mimetype2ext,
UnsupportedError,
Expand Down Expand Up @@ -553,10 +555,16 @@ def build_format_id(kind):

subtitles = {}
for text_track in json_data.get('text_tracks', []):
if text_track.get('src'):
subtitles.setdefault(text_track.get('srclang'), []).append({
'url': text_track['src'],
})
if text_track.get('kind') != 'captions':
continue
text_track_url = url_or_none(text_track.get('src'))
if not text_track_url:
continue
lang = (str_or_none(text_track.get('srclang'))
or str_or_none(text_track.get('label')) or 'en').lower()
subtitles.setdefault(lang, []).append({
'url': text_track_url,
})

is_live = False
duration = float_or_none(json_data.get('duration'), 1000)
Expand Down

0 comments on commit b4eb0bc

Please sign in to comment.