mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[vipergirls] implement login support (#4166)
This commit is contained in:
parent
db20a645c5
commit
deff3b434d
@ -395,6 +395,7 @@ Description
|
||||
* ``tapas``
|
||||
* ``tsumino``
|
||||
* ``twitter``
|
||||
* ``vipergirls``
|
||||
* ``zerochan``
|
||||
|
||||
These values can also be specified via the
|
||||
|
@ -712,7 +712,7 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<tr>
|
||||
<td>Postimg</td>
|
||||
<td>https://postimages.org/</td>
|
||||
<td>individual Images</td>
|
||||
<td>Galleries, individual Images</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -899,7 +899,7 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<td>Vipergirls</td>
|
||||
<td>https://vipergirls.to/</td>
|
||||
<td>Posts, Threads</td>
|
||||
<td></td>
|
||||
<td>Supported</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vipr</td>
|
||||
@ -995,7 +995,7 @@ Consider all sites to be NSFW unless otherwise known.
|
||||
<td>Zerochan</td>
|
||||
<td>https://www.zerochan.net/</td>
|
||||
<td>individual Images, Tag Searches</td>
|
||||
<td></td>
|
||||
<td>Supported</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>かべうち</td>
|
||||
|
@ -9,7 +9,8 @@
|
||||
"""Extractors for https://vipergirls.to/"""
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text, util
|
||||
from .. import text, util, exception
|
||||
from ..cache import cache
|
||||
|
||||
from xml.etree import ElementTree
|
||||
|
||||
@ -30,6 +31,8 @@ class VipergirlsExtractor(Extractor):
|
||||
self.session.headers["Referer"] = self.root
|
||||
|
||||
def items(self):
|
||||
self.login()
|
||||
|
||||
for post in self.posts():
|
||||
data = post.attrib
|
||||
data["thread_id"] = self.thread_id
|
||||
@ -38,6 +41,31 @@ class VipergirlsExtractor(Extractor):
|
||||
for image in post:
|
||||
yield Message.Queue, image.attrib["main_url"], data
|
||||
|
||||
def login(self):
|
||||
if not self._check_cookies(self.cookienames):
|
||||
username, password = self._get_auth_info()
|
||||
if username:
|
||||
self._update_cookies(self._login_impl(username, password))
|
||||
|
||||
@cache(maxage=90*24*3600, keyarg=1)
|
||||
def _login_impl(self, username, password):
|
||||
self.log.info("Logging in as %s", username)
|
||||
|
||||
url = "{}/login.php?do=login".format(self.root)
|
||||
data = {
|
||||
"vb_login_username": username,
|
||||
"vb_login_password": password,
|
||||
"do" : "login",
|
||||
"cookieuser" : "1",
|
||||
}
|
||||
|
||||
response = self.request(url, method="POST", data=data)
|
||||
if not response.cookies.get("vg_password"):
|
||||
raise exception.AuthenticationError()
|
||||
|
||||
return {cookie.name: cookie.value
|
||||
for cookie in response.cookies}
|
||||
|
||||
|
||||
class VipergirlsThreadExtractor(VipergirlsExtractor):
|
||||
"""Extractor for vipergirls threads"""
|
||||
|
@ -340,8 +340,10 @@ AUTH_MAP = {
|
||||
"tsumino" : "Supported",
|
||||
"tumblr" : _OAUTH,
|
||||
"twitter" : "Supported",
|
||||
"vipergirls" : "Supported",
|
||||
"wallhaven" : _APIKEY_WH,
|
||||
"weasyl" : _APIKEY_WY,
|
||||
"zerochan" : "Supported",
|
||||
}
|
||||
|
||||
IGNORE_LIST = (
|
||||
|
@ -324,7 +324,8 @@ def setup_test_config():
|
||||
|
||||
for category in ("danbooru", "atfbooru", "aibooru", "e621", "e926",
|
||||
"instagram", "twitter", "subscribestar", "deviantart",
|
||||
"inkbunny", "tapas", "pillowfort", "mangadex"):
|
||||
"inkbunny", "tapas", "pillowfort", "mangadex",
|
||||
"vipergirls"):
|
||||
config.set(("extractor", category), "username", None)
|
||||
|
||||
config.set(("extractor", "mastodon.social"), "access-token",
|
||||
|
Loading…
Reference in New Issue
Block a user