1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00

Support for videos from beta.svtplay.se

This commit is contained in:
Johan Andersson 2012-05-21 23:30:29 +02:00
parent 67cc4de993
commit 034cb204d3

View File

@ -536,6 +536,31 @@ class Svtplay():
else: else:
download_http(filename, self.output) download_http(filename, self.output)
class Svtplay2():
def __init__(self, options, output, live, resume):
self.options = options
self.output = output
self.live = live
self.resume = resume
def get(self, url):
url = url + "?type=embed&output=json"
data = json.loads(get_http_data(url))
self.live = data["video"]["live"]
streams = {}
for i in data["video"]["videoReferences"]:
if i["playerType"] == "flash":
stream = {}
stream["url"] = i["url"]
streams[i["bitrate"]] = stream
test = select_quality(self.options, streams)
if test["url"][0:4] == "rtmp":
download_rtmp(self.options, test["url"], self.output, self.live, "", self.resume)
else:
download_http(test["url"], self.output)
def main(): def main():
""" Main program """ """ Main program """
usage = "usage: %prog [options] url" usage = "usage: %prog [options] url"
@ -775,6 +800,10 @@ def main():
sr = Sr(options, output, live, other, resume) sr = Sr(options, output, live, other, resume)
sr.get("http://sverigesradio.se") sr.get("http://sverigesradio.se")
elif re.findall("beta.svtplay.se", url):
svtplay = Svtplay2(options, output, live, resume)
svtplay.get(url)
else: else:
svtplay = Svtplay(options, output, live, resume) svtplay = Svtplay(options, output, live, resume)
svtplay.get(url) svtplay.get(url)