mirror of https://github.com/yt-dlp/yt-dlp.git
[srgssr] Extract subtitles from HLS manifests
This commit is contained in:
parent
47f4203dd3
commit
efe9dba595
|
@ -87,6 +87,7 @@ class SRGSSRIE(InfoExtractor):
|
|||
title = media_data['title']
|
||||
|
||||
formats = []
|
||||
subtitles = {}
|
||||
q = qualities(['SD', 'HD'])
|
||||
for source in (media_data.get('resourceList') or []):
|
||||
format_url = source.get('url')
|
||||
|
@ -104,12 +105,16 @@ class SRGSSRIE(InfoExtractor):
|
|||
if source.get('tokenType') == 'AKAMAI':
|
||||
format_url = self._get_tokenized_src(
|
||||
format_url, media_id, format_id)
|
||||
formats.extend(self._extract_akamai_formats(
|
||||
format_url, media_id))
|
||||
fmts, subs = self._extract_akamai_formats_and_subtitles(
|
||||
format_url, media_id)
|
||||
formats.extend(fmts)
|
||||
subtitles = self._merge_subtitles(subtitles, subs)
|
||||
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',
|
||||
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'):
|
||||
formats.append({
|
||||
'format_id': format_id,
|
||||
|
@ -133,7 +138,6 @@ class SRGSSRIE(InfoExtractor):
|
|||
})
|
||||
self._sort_formats(formats)
|
||||
|
||||
subtitles = {}
|
||||
if media_type == 'video':
|
||||
for sub in (media_data.get('subtitleList') or []):
|
||||
sub_url = sub.get('url')
|
||||
|
|
Loading…
Reference in New Issue