[e621] add 'artist' & 'artist-search' extractors (#8448)
This commit is contained in:
@@ -57,6 +57,12 @@ class E621Extractor(danbooru.DanbooruExtractor):
|
||||
yield Message.Directory, post
|
||||
yield Message.Url, file["url"], post
|
||||
|
||||
def items_artists(self):
|
||||
for artist in self.artists():
|
||||
artist["_extractor"] = E621TagExtractor
|
||||
url = f"{self.root}/posts?tags={text.quote(artist['name'])}"
|
||||
yield Message.Queue, url, artist
|
||||
|
||||
def _get_notes(self, id):
|
||||
return self.request_json(
|
||||
f"{self.root}/notes.json?search[post_id]={id}")
|
||||
@@ -136,6 +142,25 @@ class E621PopularExtractor(E621Extractor, danbooru.DanbooruPopularExtractor):
|
||||
return self._pagination("/popular.json", self.params)
|
||||
|
||||
|
||||
class E621ArtistExtractor(E621Extractor, danbooru.DanbooruArtistExtractor):
|
||||
"""Extractor for e621 artists"""
|
||||
subcategory = "artist"
|
||||
pattern = rf"{BASE_PATTERN}/artists/(\d+)"
|
||||
example = "https://e621.net/artists/12345"
|
||||
|
||||
items = E621Extractor.items_artists
|
||||
|
||||
|
||||
class E621ArtistSearchExtractor(E621Extractor,
|
||||
danbooru.DanbooruArtistSearchExtractor):
|
||||
"""Extractor for e621 artist searches"""
|
||||
subcategory = "artist-search"
|
||||
pattern = rf"{BASE_PATTERN}/artists/?\?([^#]+)"
|
||||
example = "https://e621.net/artists?QUERY"
|
||||
|
||||
items = E621Extractor.items_artists
|
||||
|
||||
|
||||
class E621FavoriteExtractor(E621Extractor):
|
||||
"""Extractor for e621 favorites"""
|
||||
subcategory = "favorite"
|
||||
|
||||
Reference in New Issue
Block a user