skip login if cookies are present

This commit is contained in:
Mike Fährmann
2017-07-17 10:33:36 +02:00
parent 726c6f01ae
commit 0610ae5000
6 changed files with 22 additions and 12 deletions

View File

@@ -19,9 +19,12 @@ class BatotoExtractor():
category = "batoto"
scheme = "https"
root = "https://bato.to"
cookienames = ("member_id", "pass_hash")
def login(self):
"""Login and set necessary cookies"""
if self._check_cookies(self.cookienames, ".bato.to"):
return
username, password = self.auth_info()
if username:
cookies = self._login_impl(username, password)
@@ -53,7 +56,7 @@ class BatotoExtractor():
method="POST", params=params, data=data)
if "Sign In - " in response.text:
raise exception.AuthenticationError()
return {c: response.cookies[c] for c in ("member_id", "pass_hash")}
return {c: response.cookies[c] for c in self.cookienames}
class BatotoMangaExtractor(BatotoExtractor, MangaExtractor):