[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:
@@ -2750,6 +2750,26 @@ Description
|
|||||||
See https://wallhaven.cc/help/api for more information.
|
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
|
extractor.wallhaven.metadata
|
||||||
----------------------------
|
----------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -329,7 +329,8 @@
|
|||||||
"wallhaven":
|
"wallhaven":
|
||||||
{
|
{
|
||||||
"api-key": null,
|
"api-key": null,
|
||||||
"metadata": false
|
"metadata": false,
|
||||||
|
"include": "uploads"
|
||||||
},
|
},
|
||||||
"weasyl":
|
"weasyl":
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,6 +98,24 @@ class WallhavenCollectionExtractor(WallhavenExtractor):
|
|||||||
return {"username": self.username, "collection_id": self.collection_id}
|
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):
|
class WallhavenCollectionsExtractor(WallhavenExtractor):
|
||||||
"""Extractor for all collections of a wallhaven user"""
|
"""Extractor for all collections of a wallhaven user"""
|
||||||
subcategory = "collections"
|
subcategory = "collections"
|
||||||
@@ -119,9 +137,9 @@ class WallhavenCollectionsExtractor(WallhavenExtractor):
|
|||||||
yield Message.Queue, url, collection
|
yield Message.Queue, url, collection
|
||||||
|
|
||||||
|
|
||||||
class WallhavenUserExtractor(WallhavenExtractor):
|
class WallhavenUploadsExtractor(WallhavenExtractor):
|
||||||
"""Extractor for all uploads of a wallhaven user"""
|
"""Extractor for all uploads of a wallhaven user"""
|
||||||
subcategory = "user"
|
subcategory = "uploads"
|
||||||
directory_fmt = ("{category}", "{username}")
|
directory_fmt = ("{category}", "{username}")
|
||||||
archive_fmt = "u_{username}_{id}"
|
archive_fmt = "u_{username}_{id}"
|
||||||
pattern = r"(?:https?://)?wallhaven\.cc/user/([^/?#]+)/uploads"
|
pattern = r"(?:https?://)?wallhaven\.cc/user/([^/?#]+)/uploads"
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ SUBCATEGORY_MAP = {
|
|||||||
},
|
},
|
||||||
"wallhaven": {
|
"wallhaven": {
|
||||||
"collections": "",
|
"collections": "",
|
||||||
|
"uploads" : "",
|
||||||
},
|
},
|
||||||
"wallpapercave": {
|
"wallpapercave": {
|
||||||
"image": "individual Images, Search Results",
|
"image": "individual Images, Search Results",
|
||||||
|
|||||||
Reference in New Issue
Block a user