mirror of
https://github.com/morpheus65535/bazarr
synced 2025-02-22 14:00:52 +00:00
Fixed Ktuvit provider login
This commit is contained in:
parent
35cb757df8
commit
b137af0908
1 changed files with 13 additions and 8 deletions
|
@ -51,6 +51,11 @@ class KtuvitSubtitle(Subtitle):
|
||||||
self.subtitle_id = subtitle_id
|
self.subtitle_id = subtitle_id
|
||||||
self.release = release
|
self.release = release
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<%s [%s] %r [%s:%s]>' % (
|
||||||
|
self.__class__.__name__, self.subtitle_id, self.page_link, self.language, self._guessed_encoding)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
return str(self.subtitle_id)
|
return str(self.subtitle_id)
|
||||||
|
@ -160,13 +165,13 @@ class KtuvitProvider(Provider):
|
||||||
else:
|
else:
|
||||||
AuthenticationError("Incomplete JSON returned while authenticating to the provider.")
|
AuthenticationError("Incomplete JSON returned while authenticating to the provider.")
|
||||||
|
|
||||||
logger.debug("Logged in")
|
cookieSplit = r.headers["set-cookie"].split("Login=")
|
||||||
self.loginCookie = (
|
if len(cookieSplit) != 2:
|
||||||
r.headers["set-cookie"][1].split(";")[0].replace("Login=", "")
|
self.logged_in = False
|
||||||
)
|
AuthenticationError("Login Failed, didn't receive valid cookie in response")
|
||||||
|
|
||||||
self.session.headers["Accept"]="application/json, text/javascript, */*; q=0.01"
|
self.loginCookie = cookieSplit[1].split(";")[0]
|
||||||
self.session.headers["Cookie"]="Login=" + self.loginCookie
|
logger.debug("Logged in with cookie: " + self.loginCookie)
|
||||||
|
|
||||||
self.logged_in = True
|
self.logged_in = True
|
||||||
|
|
||||||
|
@ -449,4 +454,4 @@ class KtuvitProvider(Provider):
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
subtitle.content = fix_line_ending(r.content)
|
subtitle.content = fix_line_ending(r.content)
|
||||||
|
|
Loading…
Reference in a new issue