mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
kanal5: support for users
This commit is contained in:
parent
600c827b9e
commit
69ec4415d0
@ -18,14 +18,41 @@ class Kanal5():
|
||||
if not match:
|
||||
log.error("Can't find video file")
|
||||
sys.exit(2)
|
||||
|
||||
video_id = match.group(1)
|
||||
if options.username and options.password:
|
||||
#bogus
|
||||
cc = Cookie(None, 'asdf', None, '80', '80', 'www.kanal5play.se', None, None, '/', None, False, False, 'TestCookie', None, None, None)
|
||||
cj.set_cookie(cc)
|
||||
#get session cookie
|
||||
data = get_http_data("http://www.kanal5play.se/", cookiejar=cj)
|
||||
authurl = "https://kanal5swe.appspot.com/api/user/login?callback=jQuery171029989&email=%s&password=%s&_=136250" % (options.username, options.password)
|
||||
data = get_http_data(authurl)
|
||||
match = re.search("({.*})\);", data)
|
||||
jsondata = json.loads(match.group(1))
|
||||
if jsondata["success"] == False:
|
||||
log.error(jsondata["message"])
|
||||
sys.exit(2)
|
||||
authToken = jsondata["userData"]["auth"]
|
||||
cc = Cookie(version=0, name='authToken',
|
||||
value=authToken,
|
||||
port=None, port_specified=False,
|
||||
domain='www.kanal5play.se',
|
||||
domain_specified=True,
|
||||
domain_initial_dot=True, path='/',
|
||||
path_specified=True, secure=False,
|
||||
expires=None, discard=True, comment=None,
|
||||
comment_url=None, rest={'HttpOnly': None})
|
||||
cj.set_cookie(cc)
|
||||
|
||||
format = "FLASH"
|
||||
if options.hls:
|
||||
format = "IPHONE"
|
||||
url = "http://www.kanal5play.se/api/getVideo?format=%s&videoId=%s" % (format, match.group(1))
|
||||
data = json.loads(get_http_data(url))
|
||||
url = "http://www.kanal5play.se/api/getVideo?format=%s&videoId=%s" % (format, video_id)
|
||||
data = json.loads(get_http_data(url, cookiejar=cj))
|
||||
options.live = data["isLive"]
|
||||
if data["hasSubtitle"]:
|
||||
subtitle = "http://www.kanal5play.se/api/subtitles/%s" % match.group(1)
|
||||
subtitle = "http://www.kanal5play.se/api/subtitles/%s" % video_id)
|
||||
if options.hls:
|
||||
url = data["streams"][0]["source"]
|
||||
baseurl = url[0:url.rfind("/")]
|
||||
@ -50,5 +77,5 @@ class Kanal5():
|
||||
download_rtmp(options, steambaseurl)
|
||||
if options.subtitle:
|
||||
if options.output != "-":
|
||||
data = get_http_data(subtitle)
|
||||
data = get_http_data(subtitle, cookiejar=cj)
|
||||
subtitle_json(options, data)
|
||||
|
Loading…
Reference in New Issue
Block a user