diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index f595565..e6f7795 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -96,32 +96,26 @@ class Svtplay(Service, OpenGraphThumbMixin): for i in janson["videoReferences"]: streams = None alt_streams = None - parse = urlparse(i["url"]) - query = parse_qs(parse.query) + alt = None + query = parse_qs(urlparse(i["url"]).query) + if "alt" in query and len(query["alt"]) > 0: + alt = self.http.get(query["alt"][0]) + if i["format"] == "hls": streams = hlsparse(self.options, self.http.request("get", i["url"]), i["url"]) - - if "alt" in query and len(query["alt"]) > 0: - alt = self.http.get(query["alt"][0]) - if alt: - alt_streams = hlsparse(self.options, self.http.request("get", alt.request.url), alt.request.url) + if alt: + alt_streams = hlsparse(self.options, self.http.request("get", alt.request.url), alt.request.url) elif i["format"] == "hds": match = re.search(r"\/se\/secure\/", i["url"]) if not match: streams = hdsparse(self.options, self.http.request("get", i["url"], params={"hdcore": "3.7.0"}), i["url"]) - - if "alt" in query and len(query["alt"]) > 0: - alt = self.http.get(query["alt"][0]) - if alt: - alt_streams = hdsparse(self.options, self.http.request("get", alt.request.url, params={"hdcore": "3.7.0"}), alt.request.url) + if alt: + alt_streams = hdsparse(self.options, self.http.request("get", alt.request.url, params={"hdcore": "3.7.0"}), alt.request.url) elif i["format"] == "dash264" or i["format"] == "dashhbbtv": streams = dashparse(self.options, self.http.request("get", i["url"]), i["url"]) - - if "alt" in query and len(query["alt"]) > 0: - alt = self.http.get(query["alt"][0]) - if alt: - alt_streams = dashparse(self.options, self.http.request("get", alt.request.url), alt.request.url) + if alt: + alt_streams = dashparse(self.options, self.http.request("get", alt.request.url), alt.request.url) if streams: for n in list(streams.keys()):