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:
parent
9184a5643a
commit
ca4b2a0760
@ -294,3 +294,23 @@ class DanbooruPopularExtractor(DanbooruExtractor):
|
|||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
return self._pagination("/explore/posts/popular.json", self.params)
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user