[aryion] Add username/password support (#960)
* Add username/password support to aryion extractor * Update docs to match * Fix code style
This commit is contained in:
@@ -205,7 +205,7 @@ Some extractors require you to provide valid login credentials in the form of
|
||||
a username & password pair. This is necessary for
|
||||
``pixiv``, ``nijie``, and ``seiga``
|
||||
and optional for
|
||||
``danbooru``, ``e621``, ``exhentai``, ``idolcomplex``, ``inkbunny``,
|
||||
``aryion``, ``danbooru``, ``e621``, ``exhentai``, ``idolcomplex``, ``inkbunny``,
|
||||
``instagram``, ``luscious``, ``sankaku``, ``subscribestar``, ``tsumino``,
|
||||
and ``twitter``.
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ Description The username and password to use when attempting to log in to
|
||||
|
||||
and optional for
|
||||
|
||||
* ``aryion``
|
||||
* ``danbooru``
|
||||
* ``e621``
|
||||
* ``exhentai``
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
{
|
||||
"external": false
|
||||
},
|
||||
"aryion":
|
||||
{
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"blogger":
|
||||
{
|
||||
"videos": true
|
||||
|
||||
@@ -28,7 +28,7 @@ Doki Reader https://kobato.hologfx.com/reader/ Chapters, Manga
|
||||
Dynasty Reader https://dynasty-scans.com/ Chapters, individual Images, Search Results
|
||||
E-Hentai https://e-hentai.org/ Favorites, Galleries, Search Results Optional
|
||||
e621 https://e621.net/ Pools, Popular Images, Posts, Tag Searches Optional
|
||||
Eka's Portal https://aryion.com/ Galleries, Posts Optional (`Cookies <https://github.com/mikf/gallery-dl#cookies>`__)
|
||||
Eka's Portal https://aryion.com/ Galleries, Posts Optional
|
||||
ExHentai https://exhentai.org/ Favorites, Galleries, Search Results Optional
|
||||
Fallen Angels Scans https://www.fascans.com/ Chapters, Manga
|
||||
Fashion Nova https://www.fashionnova.com/ Collections, Products
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"""Extractors for https://aryion.com/"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text, util
|
||||
from .. import text, util, exception
|
||||
from ..cache import cache
|
||||
|
||||
|
||||
BASE_PATTERN = r"(?:https?://)?(?:www\.)?aryion\.com/g4"
|
||||
@@ -21,6 +22,8 @@ class AryionExtractor(Extractor):
|
||||
directory_fmt = ("{category}", "{user!l}", "{path:J - }")
|
||||
filename_fmt = "{id} {title}.{extension}"
|
||||
archive_fmt = "{id}"
|
||||
cookiedomain = ".aryion.com"
|
||||
cookienames = ("phpbb3_rl7a3_sid",)
|
||||
root = "https://aryion.com"
|
||||
|
||||
def __init__(self, match):
|
||||
@@ -28,7 +31,30 @@ class AryionExtractor(Extractor):
|
||||
self.user = match.group(1)
|
||||
self.recursive = True
|
||||
|
||||
def login(self):
|
||||
username, password = self._get_auth_info()
|
||||
if username:
|
||||
self._update_cookies(self._login_impl(username, password))
|
||||
|
||||
@cache(maxage=14*24*3600, keyarg=1)
|
||||
def _login_impl(self, username, password):
|
||||
self.log.info("Logging in as %s", username)
|
||||
|
||||
url = self.root + "/forum/ucp.php?mode=login"
|
||||
data = {
|
||||
"username": username,
|
||||
"password": password,
|
||||
"login": "Login",
|
||||
}
|
||||
|
||||
response = self.request(url, method="POST", data=data)
|
||||
if b"You have been successfully logged in." not in response.content:
|
||||
raise exception.AuthenticationError()
|
||||
return {c: response.cookies[c] for c in self.cookienames}
|
||||
|
||||
def items(self):
|
||||
self.login()
|
||||
|
||||
for post_id in self.posts():
|
||||
post = self._parse_post(post_id)
|
||||
if post:
|
||||
|
||||
@@ -149,7 +149,7 @@ _COOKIES = " (`Cookies <https://github.com/mikf/gallery-dl#cookies>`__)"
|
||||
_APIKEY_WH = " (`API Key <configuration.rst#extractorwallhavenapi-key>`__)"
|
||||
|
||||
AUTH_MAP = {
|
||||
"aryion" : "Optional" + _COOKIES,
|
||||
"aryion" : "Optional",
|
||||
"baraag" : "Optional" + _OAUTH,
|
||||
"danbooru" : "Optional",
|
||||
"deviantart" : "Optional" + _OAUTH,
|
||||
|
||||
Reference in New Issue
Block a user