mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-28 09:31:01 +01:00
[extractor] Detect sttp
as subtitles in MPD
Closes #656 Solution by: fstirlitz
This commit is contained in:
parent
7be9ccff0b
commit
be2fc5b212
@ -2596,7 +2596,16 @@ def extract_Initialization(source):
|
|||||||
mime_type = representation_attrib['mimeType']
|
mime_type = representation_attrib['mimeType']
|
||||||
content_type = representation_attrib.get('contentType', mime_type.split('/')[0])
|
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 = ''
|
base_url = ''
|
||||||
for element in (representation, adaptation_set, period, mpd_doc):
|
for element in (representation, adaptation_set, period, mpd_doc):
|
||||||
base_url_e = element.find(_add_ns('BaseURL'))
|
base_url_e = element.find(_add_ns('BaseURL'))
|
||||||
@ -2634,14 +2643,14 @@ def extract_Initialization(source):
|
|||||||
'filesize': filesize,
|
'filesize': filesize,
|
||||||
'container': mimetype2ext(mime_type) + '_dash',
|
'container': mimetype2ext(mime_type) + '_dash',
|
||||||
}
|
}
|
||||||
f.update(parse_codecs(representation_attrib.get('codecs')))
|
f.update(parse_codecs(codecs))
|
||||||
elif content_type == 'text':
|
elif content_type == 'text':
|
||||||
f = {
|
f = {
|
||||||
'ext': mimetype2ext(mime_type),
|
'ext': mimetype2ext(mime_type),
|
||||||
'manifest_url': mpd_url,
|
'manifest_url': mpd_url,
|
||||||
'filesize': filesize,
|
'filesize': filesize,
|
||||||
}
|
}
|
||||||
elif mime_type == 'image/jpeg':
|
elif content_type == 'image/jpeg':
|
||||||
# See test case in VikiIE
|
# See test case in VikiIE
|
||||||
# https://www.viki.com/videos/1175236v-choosing-spouse-by-lottery-episode-1
|
# https://www.viki.com/videos/1175236v-choosing-spouse-by-lottery-episode-1
|
||||||
f = {
|
f = {
|
||||||
@ -2803,8 +2812,7 @@ def add_segment_url():
|
|||||||
formats.append(f)
|
formats.append(f)
|
||||||
elif content_type == 'text':
|
elif content_type == 'text':
|
||||||
subtitles.setdefault(lang or 'und', []).append(f)
|
subtitles.setdefault(lang or 'und', []).append(f)
|
||||||
else:
|
|
||||||
self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type)
|
|
||||||
return formats, subtitles
|
return formats, subtitles
|
||||||
|
|
||||||
def _extract_ism_formats(self, *args, **kwargs):
|
def _extract_ism_formats(self, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user