]> jfr.im git - yt-dlp.git/commitdiff
[extractor] Fix root-relative URLs in MPD (#1006)
authorDigitalDJ <redacted>
Sun, 19 Sep 2021 08:37:57 +0000 (18:07 +0930)
committerGitHub <redacted>
Sun, 19 Sep 2021 08:37:57 +0000 (14:07 +0530)
Authored by: DigitalDJ

yt_dlp/extractor/common.py

index e796842312afd7fc7aaa087c181c470a35fb88d8..f6ca686a3ef7189160fce972c7e2d05c49160da7 100644 (file)
@@ -2622,8 +2622,10 @@ def extract_Initialization(source):
                             base_url = base_url_e.text + base_url
                             if re.match(r'^https?://', base_url):
                                 break
-                    if mpd_base_url and not re.match(r'^https?://', base_url):
-                        if not mpd_base_url.endswith('/') and not base_url.startswith('/'):
+                    if mpd_base_url and base_url.startswith('/'):
+                        base_url = compat_urlparse.urljoin(mpd_base_url, base_url)
+                    elif mpd_base_url and not re.match(r'^https?://', base_url):
+                        if not mpd_base_url.endswith('/'):
                             mpd_base_url += '/'
                         base_url = mpd_base_url + base_url
                     representation_id = representation_attrib.get('id')