[exhentai] store more cookies when logging in (#4881)

include 'igneous', 'hath_perks', etc
and not just 'ipb_member_id' and 'ipb_pass_hash' like before
This commit is contained in:
Mike Fährmann
2023-12-04 22:49:28 +01:00
parent ad0134daf7
commit da0da0faaa

View File

@@ -85,6 +85,7 @@ class ExhentaiExtractor(Extractor):
@cache(maxage=90*24*3600, keyarg=1) @cache(maxage=90*24*3600, keyarg=1)
def _login_impl(self, username, password): def _login_impl(self, username, password):
self.log.info("Logging in as %s", username) self.log.info("Logging in as %s", username)
url = "https://forums.e-hentai.org/index.php?act=Login&CODE=01" url = "https://forums.e-hentai.org/index.php?act=Login&CODE=01"
headers = { headers = {
"Referer": "https://e-hentai.org/bounce_login.php?b=d&bt=1-1", "Referer": "https://e-hentai.org/bounce_login.php?b=d&bt=1-1",
@@ -98,10 +99,19 @@ class ExhentaiExtractor(Extractor):
"ipb_login_submit": "Login!", "ipb_login_submit": "Login!",
} }
self.cookies.clear()
response = self.request(url, method="POST", headers=headers, data=data) response = self.request(url, method="POST", headers=headers, data=data)
if b"You are now logged in as:" not in response.content: if b"You are now logged in as:" not in response.content:
raise exception.AuthenticationError() raise exception.AuthenticationError()
return {c: response.cookies[c] for c in self.cookies_names}
# collect more cookies
url = self.root + "/favorites.php"
response = self.request(url)
if response.history:
self.request(url)
return self.cookies
class ExhentaiGalleryExtractor(ExhentaiExtractor): class ExhentaiGalleryExtractor(ExhentaiExtractor):