Fixed Ktuvit provider login

pull/1542/head v0.9.10-beta.0
Guy Khmelnitsky 3 years ago committed by GitHub
parent 35cb757df8
commit b137af0908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save