diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 991acedc..e60152dd 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -1298,19 +1298,19 @@ Consider all listed sites to potentially be NSFW. e621 https://e621.net/ - Favorites, Pools, Popular Images, Posts, Tag Searches, Frontends + Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches, Frontends Supported e926 https://e926.net/ - Favorites, Pools, Popular Images, Posts, Tag Searches + Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches Supported e6AI https://e6ai.net/ - Favorites, Pools, Popular Images, Posts, Tag Searches + Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches Supported diff --git a/gallery_dl/extractor/e621.py b/gallery_dl/extractor/e621.py index c01fd084..98446a78 100644 --- a/gallery_dl/extractor/e621.py +++ b/gallery_dl/extractor/e621.py @@ -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" diff --git a/test/results/e621.py b/test/results/e621.py index c069f671..795c8cf6 100644 --- a/test/results/e621.py +++ b/test/results/e621.py @@ -167,4 +167,47 @@ __tests__ = ( "#results" : "https://e621.net/posts?tags=rating:safe", }, +{ + "#url" : "https://e621.net/artists/54632", + "#category": ("E621", "e621", "artist"), + "#class" : e621.E621ArtistExtractor, + "#results" : "https://e621.net/posts?tags=emsibap", + + "created_at" : "2021-05-01T11:28:56.483-04:00", + "creator_id" : 338533, + "domains" : [[ + "furaffinity.net", + 3, + ]], + "group_name" : "", + "id" : 54632, + "is_active" : True, + "is_locked" : False, + "linked_user_id": None, + "name" : "emsibap", + "notes" : None, + "other_names" : [], + "updated_at" : "2021-05-01T11:28:56.488-04:00", + "urls" : [{ + "artist_id" : 54632, + "created_at" : "2021-05-01T11:28:56.486-04:00", + "id" : 217681, + "is_active" : True, + "normalized_url": "http://www.furaffinity.net/user/emsibap/", + "updated_at" : "2021-05-01T11:28:56.486-04:00", + "url" : "https://www.furaffinity.net/user/emsibap", + }], +}, + +{ + "#url" : "https://e621.net/artists?search%5Bany_name_or_url_matches%5D=emsi", + "#category": ("E621", "e621", "artist-search"), + "#class" : e621.E621ArtistSearchExtractor, + "#results" : ( + "https://e621.net/posts?tags=demsigma", + "https://e621.net/posts?tags=emsibap", + "https://e621.net/posts?tags=aluminemsiren", + ), +}, + )