1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +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():
def handle(self, url):
return "tv4play.se" in url
return ("tv4play.se" in url) or ("tv4.se" in url)
def get(self, options, url):
parse = urlparse(url)
try:
vid = parse_qs(parse[4])["video_id"][0]
except KeyError:
log.error("Can't find video file")
sys.exit(2)
if "tv4play.se" in url:
try:
vid = parse_qs(parse[4])["video_id"][0]
except KeyError:
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
data = get_http_data(url)
xml = ET.XML(data)