mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-10 20:37:59 +09:00
[common] Use mimeType to determine file extensions (#8766)
This commit is contained in:
parent
25cb05bda9
commit
a6c8b75904
@ -29,7 +29,6 @@ from ..utils import (
|
|||||||
age_restricted,
|
age_restricted,
|
||||||
bug_reports_message,
|
bug_reports_message,
|
||||||
clean_html,
|
clean_html,
|
||||||
codec2ext,
|
|
||||||
compiled_regex_type,
|
compiled_regex_type,
|
||||||
determine_ext,
|
determine_ext,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
@ -1448,8 +1447,9 @@ class InfoExtractor(object):
|
|||||||
continue
|
continue
|
||||||
representation_attrib = adaptation_set.attrib.copy()
|
representation_attrib = adaptation_set.attrib.copy()
|
||||||
representation_attrib.update(representation.attrib)
|
representation_attrib.update(representation.attrib)
|
||||||
mime_type = representation_attrib.get('mimeType')
|
# According to page 41 of ISO/IEC 29001-1:2014, @mimeType is mandatory
|
||||||
content_type = mime_type.split('/')[0] if mime_type else representation_attrib.get('contentType')
|
mime_type = representation_attrib['mimeType']
|
||||||
|
content_type = mime_type.split('/')[0]
|
||||||
if content_type == 'text':
|
if content_type == 'text':
|
||||||
# TODO implement WebVTT downloading
|
# TODO implement WebVTT downloading
|
||||||
pass
|
pass
|
||||||
@ -1472,7 +1472,7 @@ class InfoExtractor(object):
|
|||||||
f = {
|
f = {
|
||||||
'format_id': '%s-%s' % (mpd_id, representation_id) if mpd_id else representation_id,
|
'format_id': '%s-%s' % (mpd_id, representation_id) if mpd_id else representation_id,
|
||||||
'url': base_url,
|
'url': base_url,
|
||||||
'ext': codec2ext(representation_attrib.get('codecs')),
|
'ext': mimetype2ext(mime_type),
|
||||||
'width': int_or_none(representation_attrib.get('width')),
|
'width': int_or_none(representation_attrib.get('width')),
|
||||||
'height': int_or_none(representation_attrib.get('height')),
|
'height': int_or_none(representation_attrib.get('height')),
|
||||||
'tbr': int_or_none(representation_attrib.get('bandwidth'), 1000),
|
'tbr': int_or_none(representation_attrib.get('bandwidth'), 1000),
|
||||||
|
Loading…
Reference in New Issue
Block a user