From 00814e690dcfba0d50243e5f054d531a55f179fa Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 3 Jun 2018 00:13:45 +0200 Subject: [PATCH] =?UTF-8?q?o=CC=88ppetarkiv:=20no=20need=20to=20check=20if?= =?UTF-8?q?=20streams=20are=20empty=20or=20not?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/svtplay_dl/service/oppetarkiv.py | 32 +++++++++++----------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/svtplay_dl/service/oppetarkiv.py b/lib/svtplay_dl/service/oppetarkiv.py index 0111d17..a6125cd 100644 --- a/lib/svtplay_dl/service/oppetarkiv.py +++ b/lib/svtplay_dl/service/oppetarkiv.py @@ -50,46 +50,40 @@ class OppetArkiv(Service, OpenGraphThumbMixin): parse = urlparse(i["url"]) query = parse_qs(parse.query) if i["format"] == "hls" or i["format"] == "ios": - if streams: - for n in list(streams.keys()): - yield streams[n] streams = hlsparse(self.config, self.http.request("get", i["url"]), i["url"], output=self.output) + for n in list(streams.keys()): + yield streams[n] if "alt" in query and len(query["alt"]) > 0: alt = self.http.get(query["alt"][0]) if alt: streams = hlsparse(self.config, self.http.request("get", alt.request.url), alt.request.url, output=self.output) - if streams: - for n in list(streams.keys()): - yield streams[n] + for n in list(streams.keys()): + yield streams[n] if i["format"] == "hds" or i["format"] == "flash": match = re.search(r"\/se\/secure\/", i["url"]) if not match: streams = hdsparse(self.config, self.http.request("get", i["url"], params={"hdcore": "3.7.0"}), i["url"], output=self.output) - if streams: - for n in list(streams.keys()): - yield streams[n] + for n in list(streams.keys()): + yield streams[n] if "alt" in query and len(query["alt"]) > 0: alt = self.http.get(query["alt"][0]) if alt: streams = hdsparse(self.config, self.http.request("get", alt.request.url, params={"hdcore": "3.7.0"}), alt.request.url, output=self.output) - if streams: - for n in list(streams.keys()): - yield streams[n] + for n in list(streams.keys()): + yield streams[n] if i["format"] == "dash264" or i["format"] == "dashhbbtv": - streams = dashparse(self.config, self.http.request("get", i["url"]), i["url"]) - if streams: - for n in list(streams.keys()): - yield streams[n] + streams = dashparse(self.config, self.http.request("get", i["url"]), i["url"], output=self.output) + for n in list(streams.keys()): + yield streams[n] if "alt" in query and len(query["alt"]) > 0: alt = self.http.get(query["alt"][0]) if alt: streams = dashparse(self.config, self.http.request("get", alt.request.url), alt.request.url, output=self.output) - if streams: - for n in list(streams.keys()): - yield streams[n] + for n in list(streams.keys()): + yield streams[n] def find_video_id(self): match = re.search('data-video-id="([^"]+)"', self.get_urldata())