mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[mangoxo] fix login
This commit is contained in:
parent
8acbe863cb
commit
1c665fd4bd
@ -34,6 +34,11 @@ class MangoxoExtractor(Extractor):
|
||||
def _login_impl(self, username, password):
|
||||
self.log.info("Logging in as %s", username)
|
||||
|
||||
page = self.request(self.root + "/login/").text
|
||||
token = text.extract(page, 'id="loginToken" value="', '"')[0]
|
||||
if not token:
|
||||
self.log.warning("failed to extract 'loginToken'")
|
||||
|
||||
url = self.root + "/login/loginxmm"
|
||||
headers = {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
@ -42,12 +47,13 @@ class MangoxoExtractor(Extractor):
|
||||
data = {
|
||||
"name": username,
|
||||
"password": password,
|
||||
"loginToken": token,
|
||||
}
|
||||
response = self.request(url, method="POST", headers=headers, data=data)
|
||||
session = response.cookies.get("SESSION")
|
||||
if not session:
|
||||
|
||||
if response.json().get("result") != "1":
|
||||
raise exception.AuthenticationError()
|
||||
return {"SESSION": session}
|
||||
return {"SESSION": self.session.cookies.get("SESSION")}
|
||||
|
||||
@staticmethod
|
||||
def _total_pages(page):
|
||||
|
Loading…
Reference in New Issue
Block a user