[srgssr] Extract subtitles from HLS manifests

pull/247/head
Felix S 4 years ago
parent 47f4203dd3
commit efe9dba595

@ -87,6 +87,7 @@ class SRGSSRIE(InfoExtractor):
title = media_data['title'] title = media_data['title']
formats = [] formats = []
subtitles = {}
q = qualities(['SD', 'HD']) q = qualities(['SD', 'HD'])
for source in (media_data.get('resourceList') or []): for source in (media_data.get('resourceList') or []):
format_url = source.get('url') format_url = source.get('url')
@ -104,12 +105,16 @@ class SRGSSRIE(InfoExtractor):
if source.get('tokenType') == 'AKAMAI': if source.get('tokenType') == 'AKAMAI':
format_url = self._get_tokenized_src( format_url = self._get_tokenized_src(
format_url, media_id, format_id) format_url, media_id, format_id)
formats.extend(self._extract_akamai_formats( fmts, subs = self._extract_akamai_formats_and_subtitles(
format_url, media_id)) format_url, media_id)
formats.extend(fmts)
subtitles = self._merge_subtitles(subtitles, subs)
elif protocol == 'HLS': elif protocol == 'HLS':
formats.extend(self._extract_m3u8_formats( m3u8_fmts, m3u8_subs = self._extract_m3u8_formats_and_subtitles(
format_url, media_id, 'mp4', 'm3u8_native', format_url, media_id, 'mp4', 'm3u8_native',
m3u8_id=format_id, fatal=False)) m3u8_id=format_id, fatal=False)
formats.extend(m3u8_fmts)
subtitles = self._merge_subtitles(subtitles, m3u8_subs)
elif protocol in ('HTTP', 'HTTPS'): elif protocol in ('HTTP', 'HTTPS'):
formats.append({ formats.append({
'format_id': format_id, 'format_id': format_id,
@ -133,7 +138,6 @@ class SRGSSRIE(InfoExtractor):
}) })
self._sort_formats(formats) self._sort_formats(formats)
subtitles = {}
if media_type == 'video': if media_type == 'video':
for sub in (media_data.get('subtitleList') or []): for sub in (media_data.get('subtitleList') or []):
sub_url = sub.get('url') sub_url = sub.get('url')

Loading…
Cancel
Save