[inkbunny] add 'favorite' extractor (#1521)

This commit is contained in:
Mike Fährmann 2021-05-04 19:23:28 +02:00
parent 577fffad5f
commit 38ae61edd4
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 29 additions and 2 deletions

View File

@ -334,7 +334,7 @@ Consider all sites to be NSFW unless otherwise known.
<tr>
<td>Inkbunny</td>
<td>https://inkbunny.net/</td>
<td>Posts, User Profiles</td>
<td>Favorites, Posts, User Profiles</td>
<td>Supported</td>
</tr>
<tr>

View File

@ -64,7 +64,7 @@ class InkbunnyExtractor(Extractor):
class InkbunnyUserExtractor(InkbunnyExtractor):
"""Extractor for inkbunny user profiles"""
subcategory = "user"
pattern = BASE_PATTERN + r"/(?!s/)(gallery/|scraps/)?([^/?#]+)"
pattern = BASE_PATTERN + r"/(?!s/)(gallery/|scraps/)?(\w+)(?:$|[/?#])"
test = (
("https://inkbunny.net/soina", {
"pattern": r"https://[\w.]+\.metapix\.net/files/full"
@ -138,6 +138,33 @@ class InkbunnyUserExtractor(InkbunnyExtractor):
return self.api.search(params)
class InkbunnyFavoriteExtractor(InkbunnyExtractor):
"""Extractor for inkbunny user favorites"""
subcategory = "favorite"
pattern = BASE_PATTERN + r"/userfavorites_process\.php\?favs_user_id=(\d+)"
test = (
("https://inkbunny.net/userfavorites_process.php?favs_user_id=20969", {
"pattern": r"https://[\w.]+\.metapix\.net/files/full"
r"/\d+/\d+_\w+_.+",
"range": "20-50",
}),
)
def __init__(self, match):
InkbunnyExtractor.__init__(self, match)
self.user_id = match.group(1)
def posts(self):
orderby = self.config("orderby", "fav_datetime")
params = {
"favs_user_id": self.user_id,
"orderby" : orderby,
}
if orderby and orderby.startswith("unread_"):
params["unread_submissions"] = "yes"
return self.api.search(params)
class InkbunnyPostExtractor(InkbunnyExtractor):
"""Extractor for individual Inkbunny posts"""
subcategory = "post"