1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-01-24 00:52:55 +08:00

Ignore missing attributes in MPD manifests.

Some sites, like thisav, does not include all expected attributes in
their MPD manifests.

I don't know the MPD/DASH spec at all, so I can't tell if this makes
the manifest itself non-compliant... That said, it works when played
in a browser.

By not treating this attributes as not required in code and simply
moving along when we cannot find them, we seem to be able to
successfully download videos from such sites.

This closes https://github.com/rg3/youtube-dl/issues/13784.
This commit is contained in:
jaykbull 2017-11-01 09:44:10 +01:00
parent 8fe767e072
commit ecccfc8f8f

View File

@ -1806,7 +1806,9 @@ class InfoExtractor(object):
def extract_Initialization(source):
initialization = source.find(_add_ns('Initialization'))
if initialization is not None:
ms_info['initialization_url'] = initialization.attrib['sourceURL']
initialization_source_url = initialization.attrib.get('sourceURL')
if initialization_source_url is not None:
ms_info['initialization_url'] = initialization_source_url
segment_list = element.find(_add_ns('SegmentList'))
if segment_list is not None:
@ -1814,7 +1816,9 @@ class InfoExtractor(object):
extract_Initialization(segment_list)
segment_urls_e = segment_list.findall(_add_ns('SegmentURL'))
if segment_urls_e:
ms_info['segment_urls'] = [segment.attrib['media'] for segment in segment_urls_e]
segment_urls = [segment.attrib.get('media') for segment in segment_urls_e]
if segment_urls[0] is not None:
ms_info['segment_urls'] = segment_urls
else:
segment_template = element.find(_add_ns('SegmentTemplate'))
if segment_template is not None: