[mangoxo] add login support (#184)
A very recent change: It is now only possible to see more than the first 5 images of an album if you are logged in.
This commit is contained in:
@@ -61,7 +61,7 @@ MangaDex https://mangadex.org/ Chapters, Manga
|
|||||||
Mangapanda https://www.mangapanda.com/ Chapters, Manga
|
Mangapanda https://www.mangapanda.com/ Chapters, Manga
|
||||||
MangaPark https://mangapark.me/ Chapters, Manga
|
MangaPark https://mangapark.me/ Chapters, Manga
|
||||||
Mangareader https://www.mangareader.net/ Chapters, Manga
|
Mangareader https://www.mangareader.net/ Chapters, Manga
|
||||||
Mangoxo https://www.mangoxo.com/ Albums, Channels
|
Mangoxo https://www.mangoxo.com/ Albums, Channels Optional
|
||||||
Newgrounds https://www.newgrounds.com/ Images from Users, individual Images, Videos
|
Newgrounds https://www.newgrounds.com/ Images from Users, individual Images, Videos
|
||||||
Ngomik http://ngomik.in/ Chapters
|
Ngomik http://ngomik.in/ Chapters
|
||||||
nhentai https://nhentai.net/ Galleries, Search Results
|
nhentai https://nhentai.net/ Galleries, Search Results
|
||||||
|
|||||||
@@ -9,13 +9,45 @@
|
|||||||
"""Extractors for https://www.mangoxo.com/"""
|
"""Extractors for https://www.mangoxo.com/"""
|
||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from .. import text
|
from .. import text, exception
|
||||||
|
from ..cache import cache
|
||||||
|
|
||||||
|
|
||||||
class MangoxoBase():
|
class MangoxoBase():
|
||||||
"""Base class for mangoxo extractors"""
|
"""Base class for mangoxo extractors"""
|
||||||
category = "mangoxo"
|
category = "mangoxo"
|
||||||
root = "https://www.mangoxo.com"
|
root = "https://www.mangoxo.com"
|
||||||
|
cookiedomain = "www.mangoxo.com"
|
||||||
|
cookienames = ("SESSION",)
|
||||||
|
_warning = True
|
||||||
|
|
||||||
|
def login(self):
|
||||||
|
username, password = self._get_auth_info()
|
||||||
|
if username:
|
||||||
|
self._update_cookies(self._login_impl(username, password))
|
||||||
|
elif MangoxoBase._warning:
|
||||||
|
MangoxoBase._warning = False
|
||||||
|
self.log.warning("Unauthenticated users cannot see "
|
||||||
|
"more than 5 images per album")
|
||||||
|
|
||||||
|
@cache(maxage=3*3600, keyarg=1)
|
||||||
|
def _login_impl(self, username, password):
|
||||||
|
self.log.info("Logging in as %s", username)
|
||||||
|
|
||||||
|
url = self.root + "/login/loginxmm"
|
||||||
|
headers = {
|
||||||
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
|
"Referer": self.root + "/login",
|
||||||
|
}
|
||||||
|
data = {
|
||||||
|
"name": username,
|
||||||
|
"password": password,
|
||||||
|
}
|
||||||
|
response = self.request(url, method="POST", headers=headers, data=data)
|
||||||
|
session = response.cookies.get("SESSION")
|
||||||
|
if not session:
|
||||||
|
raise exception.AuthenticationError()
|
||||||
|
return {"SESSION": session}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _total_pages(page):
|
def _total_pages(page):
|
||||||
@@ -53,6 +85,7 @@ class MangoxoAlbumExtractor(MangoxoBase, Extractor):
|
|||||||
self.album_id = match.group(1)
|
self.album_id = match.group(1)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
|
self.login()
|
||||||
url = "{}/album/{}/".format(self.root, self.album_id)
|
url = "{}/album/{}/".format(self.root, self.album_id)
|
||||||
page = self.request(url).text
|
page = self.request(url).text
|
||||||
data = self.metadata(page)
|
data = self.metadata(page)
|
||||||
@@ -117,6 +150,7 @@ class MangoxoChannelExtractor(MangoxoBase, Extractor):
|
|||||||
self.channel_id = match.group(1)
|
self.channel_id = match.group(1)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
|
self.login()
|
||||||
yield Message.Version, 1
|
yield Message.Version, 1
|
||||||
url = "{}/channel/{}/".format(self.root, self.channel_id)
|
url = "{}/channel/{}/".format(self.root, self.channel_id)
|
||||||
num = total = 1
|
num = total = 1
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ AUTH_MAP = {
|
|||||||
"flickr" : "Optional (OAuth)",
|
"flickr" : "Optional (OAuth)",
|
||||||
"idolcomplex": "Optional",
|
"idolcomplex": "Optional",
|
||||||
"luscious" : "Optional",
|
"luscious" : "Optional",
|
||||||
|
"mangoxo" : "Optional",
|
||||||
"nijie" : "Required",
|
"nijie" : "Required",
|
||||||
"pixiv" : "Required",
|
"pixiv" : "Required",
|
||||||
"reddit" : "Optional (OAuth)",
|
"reddit" : "Optional (OAuth)",
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ def setup_test_config():
|
|||||||
config.set(("extractor", "seiga", "username"), email)
|
config.set(("extractor", "seiga", "username"), email)
|
||||||
config.set(("extractor", "danbooru", "username"), None)
|
config.set(("extractor", "danbooru", "username"), None)
|
||||||
config.set(("extractor", "twitter" , "username"), None)
|
config.set(("extractor", "twitter" , "username"), None)
|
||||||
|
config.set(("extractor", "mangoxo" , "password"), "VZ8DL3983u")
|
||||||
|
|
||||||
config.set(("extractor", "deviantart", "client-id"), "7777")
|
config.set(("extractor", "deviantart", "client-id"), "7777")
|
||||||
config.set(("extractor", "deviantart", "client-secret"),
|
config.set(("extractor", "deviantart", "client-secret"),
|
||||||
|
|||||||
Reference in New Issue
Block a user