1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00

Get alt query before entering specific video format

This commit is contained in:
dalgr 2017-09-26 21:56:04 +02:00 committed by Johan Andersson
parent 9284c4d76c
commit 988b557433

View File

@ -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()):