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
ebc70e87ce
commit
a63a376ad2
@ -22,7 +22,7 @@ class HentainexusGalleryExtractor(GalleryExtractor):
|
|||||||
test = (
|
test = (
|
||||||
("https://hentainexus.com/view/5688", {
|
("https://hentainexus.com/view/5688", {
|
||||||
"url": "746d0043e20030f1171aae5ea113176607302517",
|
"url": "746d0043e20030f1171aae5ea113176607302517",
|
||||||
"keyword": "c1b7091e2bc2f733f6401711e072ad11cf93dd69",
|
"keyword": "77702b42f8f76ecfe5d8a14cfbbcbd855eb14d7f",
|
||||||
}),
|
}),
|
||||||
("https://hentainexus.com/read/5688"),
|
("https://hentainexus.com/read/5688"),
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2019 Mike Fährmann
|
# Copyright 2019-2020 Mike Fährmann
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@ -12,6 +12,7 @@ from .common import Extractor, Message
|
|||||||
from .. import text, exception
|
from .. import text, exception
|
||||||
from ..cache import cache
|
from ..cache import cache
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
class MangoxoExtractor(Extractor):
|
class MangoxoExtractor(Extractor):
|
||||||
@ -35,27 +36,33 @@ class MangoxoExtractor(Extractor):
|
|||||||
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)
|
||||||
|
|
||||||
page = self.request(self.root + "/login/").text
|
url = self.root + "/api/login"
|
||||||
token = text.extract(page, 'id="loginToken" value="', '"')[0]
|
|
||||||
if not token:
|
|
||||||
self.log.debug("failed to extract 'loginToken'")
|
|
||||||
|
|
||||||
url = self.root + "/login/loginxmm"
|
|
||||||
headers = {
|
headers = {
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
"Referer": self.root + "/login",
|
"Referer": self.root + "/login",
|
||||||
}
|
}
|
||||||
data = {
|
data = self._sign_by_md5(username, password)
|
||||||
"name": username,
|
|
||||||
"password": hashlib.md5(password.encode()).hexdigest(),
|
|
||||||
"loginToken": token,
|
|
||||||
}
|
|
||||||
response = self.request(url, method="POST", headers=headers, data=data)
|
response = self.request(url, method="POST", headers=headers, data=data)
|
||||||
|
|
||||||
if response.json().get("result") != "1":
|
data = response.json()
|
||||||
raise exception.AuthenticationError()
|
if str(data.get("result")) != "1":
|
||||||
|
raise exception.AuthenticationError(data.get("msg"))
|
||||||
return {"SESSION": self.session.cookies.get("SESSION")}
|
return {"SESSION": self.session.cookies.get("SESSION")}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _sign_by_md5(username, password):
|
||||||
|
# https://dns.mangoxo.com/libs/plugins/phoenix-ui/js/phoenix-ui.js
|
||||||
|
params = [
|
||||||
|
("username" , username),
|
||||||
|
("password" , password),
|
||||||
|
("timestamp", str(int(time.time()))),
|
||||||
|
]
|
||||||
|
query = "&".join("=".join(item) for item in sorted(params))
|
||||||
|
query += "&secretKey=996293536"
|
||||||
|
sign = hashlib.md5(query.encode()).hexdigest()
|
||||||
|
params.append(("sign", sign.upper()))
|
||||||
|
return params
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _total_pages(page):
|
def _total_pages(page):
|
||||||
return text.parse_int(text.extract(page, "total :", ",")[0])
|
return text.parse_int(text.extract(page, "total :", ",")[0])
|
||||||
|
@ -28,10 +28,7 @@ TRAVIS_SKIP = {
|
|||||||
# temporary issues, etc.
|
# temporary issues, etc.
|
||||||
BROKEN = {
|
BROKEN = {
|
||||||
"35photo",
|
"35photo",
|
||||||
"dokireader",
|
|
||||||
"furaffinity",
|
|
||||||
"mangapark",
|
"mangapark",
|
||||||
"mangoxo",
|
|
||||||
"photobucket",
|
"photobucket",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user