mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[extractor] Detect sttp
as subtitles in MPD
Closes #656 Solution by: fstirlitz
This commit is contained in:
parent
7be9ccff0b
commit
be2fc5b212
1 changed files with 204 additions and 196 deletions
|
@ -2596,7 +2596,16 @@ def extract_Initialization(source):
|
|||
mime_type = representation_attrib['mimeType']
|
||||
content_type = representation_attrib.get('contentType', mime_type.split('/')[0])
|
||||
|
||||
if content_type in ('video', 'audio', 'text') or mime_type == 'image/jpeg':
|
||||
codecs = representation_attrib.get('codecs', '')
|
||||
if content_type not in ('video', 'audio', 'text'):
|
||||
if mime_type == 'image/jpeg':
|
||||
content_type = 'image/jpeg'
|
||||
if codecs.split('.')[0] == 'stpp':
|
||||
content_type = 'text'
|
||||
else:
|
||||
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
||||
continue
|
||||
|
||||
base_url = ''
|
||||
for element in (representation, adaptation_set, period, mpd_doc):
|
||||
base_url_e = element.find(_add_ns('BaseURL'))
|
||||
|
@ -2634,14 +2643,14 @@ def extract_Initialization(source):
|
|||
'filesize': filesize,
|
||||
'container': mimetype2ext(mime_type) + '_dash',
|
||||
}
|
||||
f.update(parse_codecs(representation_attrib.get('codecs')))
|
||||
f.update(parse_codecs(codecs))
|
||||
elif content_type == 'text':
|
||||
f = {
|
||||
'ext': mimetype2ext(mime_type),
|
||||
'manifest_url': mpd_url,
|
||||
'filesize': filesize,
|
||||
}
|
||||
elif mime_type == 'image/jpeg':
|
||||
elif content_type == 'image/jpeg':
|
||||
# See test case in VikiIE
|
||||
# https://www.viki.com/videos/1175236v-choosing-spouse-by-lottery-episode-1
|
||||
f = {
|
||||
|
@ -2803,8 +2812,7 @@ def add_segment_url():
|
|||
formats.append(f)
|
||||
elif content_type == 'text':
|
||||
subtitles.setdefault(lang or 'und', []).append(f)
|
||||
else:
|
||||
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
||||
|
||||
return formats, subtitles
|
||||
|
||||
def _extract_ism_formats(self, *args, **kwargs):
|
||||
|
|
Loading…
Reference in a new issue