1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[seisoparty] implement login with username & password (#1906)

This commit is contained in:
Mike Fährmann 2021-10-08 22:44:31 +02:00
parent 7c5f62b453
commit 373d3e1c57
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 30 additions and 5 deletions

View File

@ -373,6 +373,7 @@ Description
* ``mangoxo``
* ``pillowfort``
* ``sankaku``
* ``seisoparty``
* ``subscribestar``
* ``tapas``
* ``tsumino``

View File

@ -671,7 +671,7 @@ Consider all sites to be NSFW unless otherwise known.
<td>Seiso</td>
<td>https://seiso.party/</td>
<td>Favorites, Posts, User Profiles</td>
<td></td>
<td>Supported</td>
</tr>
<tr>
<td>Sen Manga</td>

View File

@ -9,7 +9,8 @@
"""Extractors for https://seiso.party/"""
from .common import Extractor, Message
from .. import text
from .. import text, exception
from ..cache import cache
import re
@ -52,6 +53,25 @@ class SeisopartyExtractor(Extractor):
"files" : self._find_files(page),
}
def login(self):
username, password = self._get_auth_info()
if username:
self._update_cookies(self._login_impl(username, password))
@cache(maxage=28*24*3600, keyarg=1)
def _login_impl(self, username, password):
self.log.info("Logging in as %s", username)
url = self.root + "/account/login"
data = {"username": username, "password": password}
response = self.request(url, method="POST", data=data)
if response.url.endswith("/account/login") and \
"Username or password is incorrect" in response.text:
raise exception.AuthenticationError()
return {c.name: c.value for c in response.history[0].cookies}
class SeisopartyUserExtractor(SeisopartyExtractor):
"""Extractor for all posts from a seiso.party user listing"""
@ -144,10 +164,12 @@ class SeisopartyFavoriteExtractor(SeisopartyExtractor):
pattern = r"(?:https?://)?seiso\.party/favorites/artists/?(?:\?([^#]+))?"
test = (
("https://seiso.party/favorites/artists", {
"count": 0,
"pattern": SeisopartyUserExtractor.pattern,
"url": "0c862434bc3bbbe84cbf41c3a6152473a8cde683",
"count": 3,
}),
("https://seiso.party/favorites/artists?page=2&sort=id", {
"count": 0,
("https://seiso.party/favorites/artists?sort=id&sort_direction=asc", {
"url": "629a8b9c6d3a8a64f521908bdb3d7426ac03f8d3",
}),
)
@ -157,6 +179,7 @@ class SeisopartyFavoriteExtractor(SeisopartyExtractor):
def items(self):
self._prepare_ddosguard_cookies()
self.login()
url = self.root + "/favorites/artists"
data = {"_extractor": SeisopartyUserExtractor}

View File

@ -238,6 +238,7 @@ AUTH_MAP = {
"reddit" : _OAUTH,
"sankaku" : "Supported",
"seiga" : "Required",
"seisoparty" : "Supported",
"smugmug" : _OAUTH,
"subscribestar" : "Supported",
"tapas" : "Supported",