From 2affb62ad0f0f5b1e299d88ad95c237f2fb5a646 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 3 Feb 2024 05:26:52 +0000 Subject: [PATCH] Fix SegmentList source/media join with Base URL in DASH download_track() --- devine/core/manifests/dash.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index ca9ef2b..0d9e772 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -350,8 +350,8 @@ class DASH: initialization = segment_list.find("Initialization") if initialization is not None: source_url = initialization.get("sourceURL") - if source_url is None: - source_url = rep_base_url + if not source_url or not re.match("^https?://", source_url, re.IGNORECASE): + source_url = urljoin(rep_base_url, f"./{source_url}") if initialization.get("range"): init_range_header = {"Range": f"bytes={initialization.get('range')}"} @@ -366,8 +366,8 @@ class DASH: segment_urls = segment_list.findall("SegmentURL") for segment_url in segment_urls: media_url = segment_url.get("media") - if media_url is None: - media_url = rep_base_url + if not media_url or not re.match("^https?://", media_url, re.IGNORECASE): + media_url = urljoin(rep_base_url, f"./{media_url}") segments.append(( media_url,