From f5e967bffc6c639e9a452dfd2e5b116cbb723548 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 29 Sep 2020 20:39:27 +0200 Subject: [PATCH] dplay: add some error checks. --- lib/svtplay_dl/service/dplay.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/svtplay_dl/service/dplay.py b/lib/svtplay_dl/service/dplay.py index 755d56e..4375207 100644 --- a/lib/svtplay_dl/service/dplay.py +++ b/lib/svtplay_dl/service/dplay.py @@ -32,12 +32,18 @@ class Dplay(Service): channel = False if "kanaler" in parse.path: match = re.search("kanaler/([^/]+)$", parse.path) + if not match: + yield ServiceError("Can't detect 'kanaler'") + return path = "/channels/{}".format(match.group(1)) url = "https://disco-api.{}/content{}".format(self.domain, path) channel = True self.config.set("live", True) elif "program" in parse.path: match = re.search("(programmer|program)/([^/]+)$", parse.path) + if not match: + yield ServiceError("Can't find program url") + return path = "/shows/{}".format(match.group(2)) url = "https://disco-api.{}/content{}".format(self.domain, path) res = self.http.get(url, headers={"x-disco-client": "WEB:UNKNOWN:dplay-client:0.0.1"})