diff --git a/README.md b/README.md index b27a3e5..5fd1339 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ This script works for: * tv6play.se * tv8play.se * twitch.tv +* ur.se * urplay.se If you have OS X and [Homebrew](http://mxcl.github.com/homebrew/) you can install with: diff --git a/lib/svtplay/service/urplay.py b/lib/svtplay/service/urplay.py index e0bde83..d818320 100644 --- a/lib/svtplay/service/urplay.py +++ b/lib/svtplay/service/urplay.py @@ -2,9 +2,12 @@ # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- from __future__ import absolute_import import re +import json from svtplay.utils import get_http_data from svtplay.rtmp import download_rtmp +from svtplay.hds import download_hds +from svtplay.hls import download_hls class Urplay(): def handle(self, url): @@ -12,9 +15,19 @@ class Urplay(): def get(self, options, url): data = get_http_data(url) - match = re.search('file=(.*)\&plugins', data) - if match: - path = "mp%s:%s" % (match.group(1)[-1], match.group(1)) - options.other = "-a ondemand -y %s" % path - download_rtmp(options, "rtmp://streaming.ur.se/") - + data = re.search("urPlayer.init\((.*)\);", data) + data = re.sub("(\w+): ", r'"\1":',data.group(1)) + data = data.replace("\'", "\"").replace("\",}","\"}").replace("(m = location.hash.match(/[#&]start=(\d+)/)) ? m[1] : 0,","0") + jsondata = json.loads(data) + basedomain = jsondata["streaming_config"]["streamer"]["redirect"] + http = "http://%s/%s" % (basedomain, jsondata["file_html5"]) + hds = "%s%s" % (http, jsondata["streaming_config"]["http_streaming"]["hds_file"]) + hls = "%s%s" % (http, jsondata["streaming_config"]["http_streaming"]["hls_file"]) + rtmp = "rtmp://%s/%s" % (basedomain, jsondata["streaming_config"]["rtmp"]["application"]) + path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"]) + options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path) + if options.hls: + download_hls(options, hls, http) + if jsondata["file_flash"][-1] == "3": + download_rtmp(options, rtmp) + download_hds(options, hds)