[universal] quick & dirty support for MPD files (with BaseURL)

This commit is contained in:
Mort Yao 2017-09-12 12:37:16 +02:00
parent 854c78fd6f
commit 388b214f07
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -67,6 +67,13 @@ def universal_download(url, output_dir='.', merge=True, info_only=False, **kwarg
urls += re.findall(r'href="(https?://[^"]+\.png)"', page) urls += re.findall(r'href="(https?://[^"]+\.png)"', page)
urls += re.findall(r'href="(https?://[^"]+\.gif)"', page) urls += re.findall(r'href="(https?://[^"]+\.gif)"', page)
# MPEG-DASH MPD
mpd_urls = re.findall(r'src="(https?://[^"]+\.mpd)"', page)
for mpd_url in mpd_urls:
cont = get_content(mpd_url)
base_url = r1(r'<BaseURL>(.*)</BaseURL>', cont)
urls += [ r1(r'(.*/)[^/]*', mpd_url) + base_url ]
# have some candy! # have some candy!
candies = [] candies = []
i = 1 i = 1