From 4ebf565652eb387bf0c9ae61b5058b96b0349a05 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 16 Apr 2013 13:18:40 +0200 Subject: [PATCH] svtplay: support for oppetarkiv.se --- lib/svtplay_dl/__init__.py | 2 +- lib/svtplay_dl/service/svtplay.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py index 982f723..a25b2fd 100644 --- a/lib/svtplay_dl/__init__.py +++ b/lib/svtplay_dl/__init__.py @@ -12,7 +12,7 @@ from svtplay_dl.utils import get_http_data from svtplay_dl.service import service_handler, Generic -__version__ = "0.9.2013.04.14-dev" +__version__ = "0.9.2013.04.16-dev" class Options: """ diff --git a/lib/svtplay_dl/service/svtplay.py b/lib/svtplay_dl/service/svtplay.py index a3549fa..d95443a 100644 --- a/lib/svtplay_dl/service/svtplay.py +++ b/lib/svtplay_dl/service/svtplay.py @@ -17,7 +17,7 @@ from svtplay_dl.log import log class Svtplay(Service): def handle(self, url): - return ("svtplay.se" in url) or ("svt.se" in url) + return ("svtplay.se" in url) or ("svt.se" in url) or ("oppetarkiv.se" in url) def get(self, options, url): if re.findall("svt.se", url): @@ -31,12 +31,15 @@ class Svtplay(Service): sys.exit(2) url = "%s?type=embed" % url data = get_http_data(url) - match = re.search("value=\"(/(public)?(statiskt)?/swf/video/svtplayer-[0-9\.]+swf)\"", data) + match = re.search("value=\"(/(public)?(statiskt)?/swf(/video)?/svtplayer-[0-9\.a-f]+swf)\"", data) swf = "http://www.svtplay.se%s" % match.group(1) options.other = "-W %s" % swf url = "%s&output=json&format=json" % url data = json.loads(get_http_data(url)) - options.live = data["video"]["live"] + if "live" in data["video"]: + options.live = data["video"]["live"] + else: + options.live = False streams = {} streams2 = {} #hack.. for i in data["video"]["videoReferences"]: