1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

TV4play: remove login functionality

Tv4play has changed their login forms  and as all premium content has moved to cmore.se login functionality is no longer needed and therefore removed.
This commit is contained in:
qnorsten 2017-04-21 18:18:29 +02:00
parent 49440b5f94
commit c8525f3a22

View File

@ -29,11 +29,11 @@ class Tv4play(Service, OpenGraphThumbMixin):
yield ServiceError("Can't find video id for %s" % self.url)
return
if self.options.username and self.options.password:
work = self._login(self.options.username, self.options.password)
if isinstance(work, Exception):
yield work
return
# if self.options.username and self.options.password:
# work = self._login(self.options.username, self.options.password)
# if isinstance(work, Exception):
# yield work
# return
url = "http://prima.tv4play.se/api/web/asset/%s/play" % vid
data = self.http.request("get", url, cookies=self.cookies)
@ -195,11 +195,11 @@ class Tv4play(Service, OpenGraphThumbMixin):
def find_all_episodes(self, options):
premium = False
if options.username and options.password:
premium = self._login(options.username, options.password)
if isinstance(premium, Exception):
log.error(premium.message)
return None
# if options.username and options.password:
# premium = self._login(options.username, options.password)
# if isinstance(premium, Exception):
# log.error(premium.message)
# return None
jsondata = self._get_show_info()
@ -226,24 +226,24 @@ class Tv4play(Service, OpenGraphThumbMixin):
return episodes
def _login(self, username, password):
data = self.http.request("get", "https://www.tv4play.se/session/new?https=")
url = "https://account.services.tv4play.se/session/authenticate"
postdata = {"username" : username, "password": password, "https": "", "client": "web"}
# def _login(self, username, password):
# data = self.http.request("get", "https://www.tv4play.se/session/new?https=")
# url = "https://account.services.tv4play.se/session/authenticate"
# postdata = {"username" : username, "password": password, "https": "", "client": "web"}
data = self.http.request("post", url, data=postdata, cookies=self.cookies)
try:
res = data.json()
except ValueError:
return ServiceError("Cant decode output from tv4play")
if "errors" in res:
message = res["errors"][0]
if is_py2:
message = message.encode("utf8")
return ServiceError(message)
self.cookies={"JSESSIONID": res["vimond_session_token"]}
# data = self.http.request("post", url, data=postdata, cookies=self.cookies)
# try:
# res = data.json()
# except ValueError:
# return ServiceError("Cant decode output from tv4play")
# if "errors" in res:
# message = res["errors"][0]
# if is_py2:
# message = message.encode("utf8")
# return ServiceError(message)
# self.cookies={"JSESSIONID": res["vimond_session_token"]}
return True
# return True
def findvid(url, data):