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

[danbooru] add 'artist' extractor (#5348)

This commit is contained in:
Mike Fährmann 2024-11-17 16:20:20 +01:00
parent 9184a5643a
commit ca4b2a0760
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -294,3 +294,23 @@ class DanbooruPopularExtractor(DanbooruExtractor):
def posts(self):
return self._pagination("/explore/posts/popular.json", self.params)
class DanbooruArtistExtractor(DanbooruExtractor):
"""Extractor for danbooru artists"""
subcategory = "artist"
pattern = BASE_PATTERN + r"/artists/(\d+)"
example = "https://danbooru.donmai.us/artists/12345"
def items(self):
url = "{}/artists/{}.json".format(self.root, self.groups[-1])
artist = self.request(url).json()
url = "{}/posts?tags={}".format(
self.root, text.quote(artist["name"]))
data = {
"_extractor": DanbooruTagExtractor,
"artist" : artist,
}
yield Message.Directory, data
yield Message.Queue, url, data