[e621] add 'artist' & 'artist-search' extractors (#8448)
This commit is contained in:
@@ -1298,19 +1298,19 @@ Consider all listed sites to potentially be NSFW.
|
|||||||
<tr id="e621" title="e621">
|
<tr id="e621" title="e621">
|
||||||
<td>e621</td>
|
<td>e621</td>
|
||||||
<td>https://e621.net/</td>
|
<td>https://e621.net/</td>
|
||||||
<td>Favorites, Pools, Popular Images, Posts, Tag Searches, Frontends</td>
|
<td>Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches, Frontends</td>
|
||||||
<td>Supported</td>
|
<td>Supported</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="e926" title="e926">
|
<tr id="e926" title="e926">
|
||||||
<td>e926</td>
|
<td>e926</td>
|
||||||
<td>https://e926.net/</td>
|
<td>https://e926.net/</td>
|
||||||
<td>Favorites, Pools, Popular Images, Posts, Tag Searches</td>
|
<td>Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches</td>
|
||||||
<td>Supported</td>
|
<td>Supported</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="e6ai" title="e6ai">
|
<tr id="e6ai" title="e6ai">
|
||||||
<td>e6AI</td>
|
<td>e6AI</td>
|
||||||
<td>https://e6ai.net/</td>
|
<td>https://e6ai.net/</td>
|
||||||
<td>Favorites, Pools, Popular Images, Posts, Tag Searches</td>
|
<td>Artists, Artist Searches, Favorites, Pools, Popular Images, Posts, Tag Searches</td>
|
||||||
<td>Supported</td>
|
<td>Supported</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ class E621Extractor(danbooru.DanbooruExtractor):
|
|||||||
yield Message.Directory, post
|
yield Message.Directory, post
|
||||||
yield Message.Url, file["url"], 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):
|
def _get_notes(self, id):
|
||||||
return self.request_json(
|
return self.request_json(
|
||||||
f"{self.root}/notes.json?search[post_id]={id}")
|
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)
|
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):
|
class E621FavoriteExtractor(E621Extractor):
|
||||||
"""Extractor for e621 favorites"""
|
"""Extractor for e621 favorites"""
|
||||||
subcategory = "favorite"
|
subcategory = "favorite"
|
||||||
|
|||||||
@@ -167,4 +167,47 @@ __tests__ = (
|
|||||||
"#results" : "https://e621.net/posts?tags=rating:safe",
|
"#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",
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user