diff options
author | Sergey M․ <[email protected]> | 2020-06-05 23:33:14 +0700 |
---|---|---|
committer | Sergey M․ <[email protected]> | 2020-06-05 23:33:14 +0700 |
commit | b4eb0bc7bd2524a63e3a6441fe82a6cfd8ebc365 (patch) | |
tree | f11c5d30bf3012fc41900b26ab139dfe8e038fa4 /youtube_dl/extractor/brightcove.py | |
parent | d5147b65ac3d81b5acb4aa2c4aca008ffd3e7c06 (diff) | |
download | youtube-dl-b4eb0bc7bd2524a63e3a6441fe82a6cfd8ebc365.tar.gz youtube-dl-b4eb0bc7bd2524a63e3a6441fe82a6cfd8ebc365.zip |
[brightcove] Fix subtitles extraction (closes #25540)
Diffstat (limited to 'youtube_dl/extractor/brightcove.py')
-rw-r--r-- | youtube_dl/extractor/brightcove.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 85001b3ad..462815317 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -25,9 +25,11 @@ from ..utils import ( int_or_none, parse_iso8601, smuggle_url, + str_or_none, unescapeHTML, unsmuggle_url, update_url_query, + url_or_none, clean_html, mimetype2ext, UnsupportedError, @@ -553,10 +555,16 @@ class BrightcoveNewIE(AdobePassIE): 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) |