From 816a53ad8b8664b1d42925bc111d75e7c9613e16 Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 8 Apr 2012 14:08:10 +0200 Subject: [PATCH] Update the sr.se part. Now you can download the file if you link to the playlist. --- svtplay-dl | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/svtplay-dl b/svtplay-dl index 5ce0b11..c68f763 100755 --- a/svtplay-dl +++ b/svtplay-dl @@ -16,7 +16,7 @@ from optparse import OptionParser import xml.etree.ElementTree as ET import shlex -__version__ = "0.7.2012.04.07" +__version__ = "0.7.2012.04.08" class Common(object): logtosderr = False @@ -34,11 +34,11 @@ class Common(object): response = urlopen(request) except HTTPError as e: self.to_console("Something wrong with that url") - self.to_console("Error code:", e.code) + self.to_console("Error code: %s" % e.code) sys.exit(5) except URLError as e: self.to_console("Something wrong with that url") - self.to_console("Error code:", e.reason) + self.to_console("Error code: %s" % e.reason) sys.exit(5) except ValueError as e: self.to_console("Try adding http:// before the url") @@ -803,12 +803,17 @@ def main(): elif re.findall("sverigesradio", url): data = common.getdata(url) - match = re.search("linkUrl=(.*)\;isButton=", data) - if not match: - common.to_console("Cant find video file") - sys.exit(2) - - sr = Sr(common, output, quality, live, unquote_plus(match.group(1)), resume) + parse = urlparse(url) + try: + metafile = parse_qs(parse[4])["metafile"][0] + other = "%s?%s" % (parse[2], parse[4]) + except KeyError: + match = re.search("linkUrl=(.*)\;isButton=", data) + if not match: + common.to_console("Cant find video file") + sys.exit(2) + other = unquote_plus(match.group(1)) + sr = Sr(common, output, quality, live, other, resume) sr.get("http://sverigesradio.se") else: