From 8e547f436d141c6de18af3cf5fd39bf51c739e10 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Mon, 28 Jan 2013 22:47:54 +0100 Subject: [PATCH] tv4play: some fixes for tv4.se In some cases we dont have vid in the url --- svtplay_dl.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/svtplay_dl.py b/svtplay_dl.py index 631f662..aa948fd 100755 --- a/svtplay_dl.py +++ b/svtplay_dl.py @@ -910,8 +910,13 @@ class Tv4play(): if match: vid = match.group(1) else: - log.error("Can't find video file") - sys.exit(2) + data = get_http_data(url) + match = re.search("\"vid\":\"(\d+)\",", data) + if match: + vid = match.group(1) + else: + log.error("Can't find video file") + sys.exit(2) url = "http://premium.tv4play.se/api/web/asset/%s/play" % vid data = get_http_data(url)