From 5919935d5051cea1a6e8bddba7623698d8df3074 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Fri, 5 Apr 2024 22:19:26 +0200 Subject: [PATCH] dash: absolute url support --- lib/svtplay_dl/fetcher/dash.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/svtplay_dl/fetcher/dash.py b/lib/svtplay_dl/fetcher/dash.py index ae63f3b..dcc5b74 100644 --- a/lib/svtplay_dl/fetcher/dash.py +++ b/lib/svtplay_dl/fetcher/dash.py @@ -101,7 +101,10 @@ def templateelemt(attributes, element, filename, idnumber): segments.append({"number": number, "duration": int(attributes.get("duration") / attributes.get("timescale"))}) name = media.replace("$RepresentationID$", idnumber).replace("$Bandwidth$", attributes.get("bandwidth")) - files.append(urljoin(filename, init.replace("$RepresentationID$", idnumber).replace("$Bandwidth$", attributes.get("bandwidth")))) + if init[:4] == "http": + files.append(init.replace("$RepresentationID$", idnumber).replace("$Bandwidth$", attributes.get("bandwidth"))) + else: + files.append(urljoin(filename, init.replace("$RepresentationID$", idnumber).replace("$Bandwidth$", attributes.get("bandwidth")))) for segment in segments: if "$Time$" in media: new = name.replace("$Time$", str(segment["time"])) @@ -112,7 +115,10 @@ def templateelemt(attributes, element, filename, idnumber): else: new = name.replace("$Number$", str(segment["number"])) - files.append(urljoin(filename, new)) + if new[:4] == "http": + files.append(new) + else: + files.append(urljoin(filename, new)) return files