mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
Support for videos from beta.svtplay.se
This commit is contained in:
parent
67cc4de993
commit
034cb204d3
29
svtplay-dl
29
svtplay-dl
@ -536,6 +536,31 @@ class Svtplay():
|
||||
else:
|
||||
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():
|
||||
""" Main program """
|
||||
usage = "usage: %prog [options] url"
|
||||
@ -775,6 +800,10 @@ def main():
|
||||
sr = Sr(options, output, live, other, resume)
|
||||
sr.get("http://sverigesradio.se")
|
||||
|
||||
elif re.findall("beta.svtplay.se", url):
|
||||
svtplay = Svtplay2(options, output, live, resume)
|
||||
svtplay.get(url)
|
||||
|
||||
else:
|
||||
svtplay = Svtplay(options, output, live, resume)
|
||||
svtplay.get(url)
|
||||
|
Loading…
Reference in New Issue
Block a user