[brightcove] Fix subtitles extraction (closes #25540)

This commit is contained in:
Sergey M․ 2020-06-05 23:33:14 +07:00
parent d5147b65ac
commit b4eb0bc7bd
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -25,9 +25,11 @@ from ..utils import (
int_or_none, int_or_none,
parse_iso8601, parse_iso8601,
smuggle_url, smuggle_url,
str_or_none,
unescapeHTML, unescapeHTML,
unsmuggle_url, unsmuggle_url,
update_url_query, update_url_query,
url_or_none,
clean_html, clean_html,
mimetype2ext, mimetype2ext,
UnsupportedError, UnsupportedError,
@ -553,9 +555,15 @@ class BrightcoveNewIE(AdobePassIE):
subtitles = {} subtitles = {}
for text_track in json_data.get('text_tracks', []): for text_track in json_data.get('text_tracks', []):
if text_track.get('src'): if text_track.get('kind') != 'captions':
subtitles.setdefault(text_track.get('srclang'), []).append({ continue
'url': text_track['src'], 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 is_live = False