Compare commits

...

2 Commits

Author SHA1 Message Date
Diazole
17d7861d6f
Apply suggestions from code review
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-10-07 15:08:43 +01:00
Diazole
9489857e0a
Update yt_dlp/extractor/common.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2023-10-07 15:07:34 +01:00

View File

@ -2644,8 +2644,7 @@ class InfoExtractor:
'timescale': 1, 'timescale': 1,
}) })
for adaptation_set in period.findall(_add_ns('AdaptationSet')): for adaptation_set in period.findall(_add_ns('AdaptationSet')):
role_node = adaptation_set.find(_add_ns('Role')) role = try_call(lambda: adaptation_set.find(_add_ns('Role')).attrib['value'])
adaption_set_ms_info = extract_multisegment_info(adaptation_set, period_ms_info) adaption_set_ms_info = extract_multisegment_info(adaptation_set, period_ms_info)
for representation in adaptation_set.findall(_add_ns('Representation')): for representation in adaptation_set.findall(_add_ns('Representation')):
representation_attrib = adaptation_set.attrib.copy() representation_attrib = adaptation_set.attrib.copy()
@ -2714,14 +2713,14 @@ class InfoExtractor:
'filesize': filesize, 'filesize': filesize,
'container': mimetype2ext(mime_type) + '_dash', 'container': mimetype2ext(mime_type) + '_dash',
**codecs, **codecs,
'role': role_node.attrib.get('value') if role_node is not None else None, 'role': role,
} }
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,
'role': role_node.attrib.get('value') if role_node is not None else None, 'role': role,
} }
elif content_type == 'image/jpeg': elif content_type == 'image/jpeg':
# See test case in VikiIE # See test case in VikiIE