mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
[wallhaven] update 'user' extractor (#3226)
* [wallhaven] update 'user' extractor * [wallhaven] update 'configuration.rst' add 'extractor.wallhaven.include' entry * [wallhaven] add 'wallhaven.include' in gallery-dl.conf
This commit is contained in:
parent
5a68b5cb3c
commit
7897f68225
@ -2750,6 +2750,26 @@ Description
|
||||
See https://wallhaven.cc/help/api for more information.
|
||||
|
||||
|
||||
extractor.wallhaven.include
|
||||
---------------------------
|
||||
Type
|
||||
* ``string``
|
||||
* ``list`` of ``strings``
|
||||
Default
|
||||
``"uploads"``
|
||||
Example
|
||||
* ``"uploads,collections"``
|
||||
* ``["uploads", "collections"]``
|
||||
Description
|
||||
A (comma-separated) list of subcategories to include
|
||||
when processing a user profile.
|
||||
|
||||
Possible values are
|
||||
``"uploads"``, ``"collections"``.
|
||||
|
||||
It is possible to use ``"all"`` instead of listing all values separately.
|
||||
|
||||
|
||||
extractor.wallhaven.metadata
|
||||
----------------------------
|
||||
Type
|
||||
|
@ -329,7 +329,8 @@
|
||||
"wallhaven":
|
||||
{
|
||||
"api-key": null,
|
||||
"metadata": false
|
||||
"metadata": false,
|
||||
"include": "uploads"
|
||||
},
|
||||
"weasyl":
|
||||
{
|
||||
|
@ -98,6 +98,24 @@ class WallhavenCollectionExtractor(WallhavenExtractor):
|
||||
return {"username": self.username, "collection_id": self.collection_id}
|
||||
|
||||
|
||||
class WallhavenUserExtractor(WallhavenExtractor):
|
||||
"""Extractor for a wallhaven user"""
|
||||
subcategory = "user"
|
||||
pattern = r"(?:https?://)?wallhaven\.cc/user/([^/?#]+)/?$"
|
||||
test = ("https://wallhaven.cc/user/AksumkA/",)
|
||||
|
||||
def __init__(self, match):
|
||||
WallhavenExtractor.__init__(self, match)
|
||||
self.username = match.group(1)
|
||||
|
||||
def items(self):
|
||||
base = "{}/user/{}/".format(self.root, self.username)
|
||||
return self._dispatch_extractors((
|
||||
(WallhavenUploadsExtractor , base + "uploads"),
|
||||
(WallhavenCollectionsExtractor, base + "favorites"),
|
||||
), ("uploads",))
|
||||
|
||||
|
||||
class WallhavenCollectionsExtractor(WallhavenExtractor):
|
||||
"""Extractor for all collections of a wallhaven user"""
|
||||
subcategory = "collections"
|
||||
@ -119,9 +137,9 @@ class WallhavenCollectionsExtractor(WallhavenExtractor):
|
||||
yield Message.Queue, url, collection
|
||||
|
||||
|
||||
class WallhavenUserExtractor(WallhavenExtractor):
|
||||
class WallhavenUploadsExtractor(WallhavenExtractor):
|
||||
"""Extractor for all uploads of a wallhaven user"""
|
||||
subcategory = "user"
|
||||
subcategory = "uploads"
|
||||
directory_fmt = ("{category}", "{username}")
|
||||
archive_fmt = "u_{username}_{id}"
|
||||
pattern = r"(?:https?://)?wallhaven\.cc/user/([^/?#]+)/uploads"
|
||||
|
@ -233,6 +233,7 @@ SUBCATEGORY_MAP = {
|
||||
},
|
||||
"wallhaven": {
|
||||
"collections": "",
|
||||
"uploads" : "",
|
||||
},
|
||||
"wallpapercave": {
|
||||
"image": "individual Images, Search Results",
|
||||
|
Loading…
Reference in New Issue
Block a user