[universal] support site-relative path

This commit is contained in:
Mort Yao 2020-04-12 01:02:51 +02:00
parent 018cfde604
commit c34c0af6a4
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -99,6 +99,14 @@ def universal_download(url, output_dir='.', merge=True, info_only=False, **kwarg
for rel_url in rel_urls:
urls += [ r1(r'(.*/)', url) + rel_url ]
# site-relative path
rel_urls = []
rel_urls += re.findall(r'href="(/[^"]+\.jpe?g)"', page, re.I)
rel_urls += re.findall(r'href="(/[^"]+\.png)"', page, re.I)
rel_urls += re.findall(r'href="(/[^"]+\.gif)"', page, re.I)
for rel_url in rel_urls:
urls += [ r1(r'(https?://[^/]+)', url) + rel_url ]
# MPEG-DASH MPD
mpd_urls = re.findall(r'src="(https?://[^"]+\.mpd)"', page)
for mpd_url in mpd_urls: