1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

tv4play: adding support for tv4.se

This commit is contained in:
Johan Andersson 2013-01-15 17:20:56 +01:00
parent 55782715cb
commit ff73f768f0

View File

@ -889,15 +889,24 @@ class Viaplay():
class Tv4play(): class Tv4play():
def handle(self, url): def handle(self, url):
return "tv4play.se" in url return ("tv4play.se" in url) or ("tv4.se" in url)
def get(self, options, url): def get(self, options, url):
parse = urlparse(url) parse = urlparse(url)
try: if "tv4play.se" in url:
vid = parse_qs(parse[4])["video_id"][0] try:
except KeyError: vid = parse_qs(parse[4])["video_id"][0]
log.error("Can't find video file") except KeyError:
sys.exit(2) log.error("Can't find video file")
sys.exit(2)
else:
match = re.search("-(\d+)$", url)
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 url = "http://premium.tv4play.se/api/web/asset/%s/play" % vid
data = get_http_data(url) data = get_http_data(url)
xml = ET.XML(data) xml = ET.XML(data)