1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-23 19:55:38 +01:00

urplay: add support for the new site

some help from @unayok
This commit is contained in:
Johan Andersson 2013-03-03 10:58:37 +01:00 committed by Olof Johansson
parent 60baa1dba0
commit ee375f5d64
2 changed files with 20 additions and 6 deletions

View File

@ -30,6 +30,7 @@ This script works for:
* tv6play.se * tv6play.se
* tv8play.se * tv8play.se
* twitch.tv * twitch.tv
* ur.se
* urplay.se * urplay.se
If you have OS X and [Homebrew](http://mxcl.github.com/homebrew/) you can install with: If you have OS X and [Homebrew](http://mxcl.github.com/homebrew/) you can install with:

View File

@ -2,9 +2,12 @@
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import from __future__ import absolute_import
import re import re
import json
from svtplay.utils import get_http_data from svtplay.utils import get_http_data
from svtplay.rtmp import download_rtmp from svtplay.rtmp import download_rtmp
from svtplay.hds import download_hds
from svtplay.hls import download_hls
class Urplay(): class Urplay():
def handle(self, url): def handle(self, url):
@ -12,9 +15,19 @@ class Urplay():
def get(self, options, url): def get(self, options, url):
data = get_http_data(url) data = get_http_data(url)
match = re.search('file=(.*)\&plugins', data) data = re.search("urPlayer.init\((.*)\);", data)
if match: data = re.sub("(\w+): ", r'"\1":',data.group(1))
path = "mp%s:%s" % (match.group(1)[-1], match.group(1)) data = data.replace("\'", "\"").replace("\",}","\"}").replace("(m = location.hash.match(/[#&]start=(\d+)/)) ? m[1] : 0,","0")
options.other = "-a ondemand -y %s" % path jsondata = json.loads(data)
download_rtmp(options, "rtmp://streaming.ur.se/") 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)