From 05a20520b0fca4f1c2e01b53ca5db3393d35480e Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Thu, 17 Mar 2016 16:57:58 +0100 Subject: [PATCH] svtplay: fix embedded videos on svt.se --- lib/svtplay_dl/service/svtplay.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index 4976e40..4215727 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -47,7 +47,11 @@ class Svtplay(Service, OpenGraphThumbMixin): self.options.live = data["live"] if old: params = {"output": "json"} - dataj = self.http.request("get", self.url, params=params).json() + try: + dataj = self.http.request("get", self.url, params=params).json() + except ValueError: + dataj = data + old = False else: dataj = data @@ -98,6 +102,9 @@ class Svtplay(Service, OpenGraphThumbMixin): return match.group(1) parse = urlparse(self.url) match = re.search("/video/([0-9]+)/", parse.path) + if match: + return match.group(1) + match = re.search("data-video-id='([^']+)'", self.get_urldata()) if match: return match.group(1) match = re.search("/videoEpisod-([^/]+)/", parse.path)