Fix SegmentList source/media join with Base URL in DASH download_track()

This commit is contained in:
rlaphoenix 2024-02-03 05:26:52 +00:00
parent 30abe26321
commit 2affb62ad0
1 changed files with 4 additions and 4 deletions

View File

@ -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,