Skip to content

Commit

Permalink
[inkbunny] add 'unread' extractor (#4934)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Dec 15, 2023
1 parent 8b87a53 commit 2852404
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Inkbunny</td>
<td>https://inkbunny.net/</td>
<td>Favorites, Followed Users, Pools, Posts, Search Results, User Profiles</td>
<td>Favorites, Followed Users, Pools, Posts, Search Results, Unread Submissions, User Profiles</td>
<td>Supported</td>
</tr>
<tr>
Expand Down
20 changes: 20 additions & 0 deletions gallery_dl/extractor/inkbunny.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ def posts(self):
return self.api.search(params)


class InkbunnyUnreadExtractor(InkbunnyExtractor):
"""Extractor for unread inkbunny submissions"""
subcategory = "unread"
pattern = (BASE_PATTERN +
r"/submissionsviewall\.php\?([^#]+&mode=unreadsubs&[^#]+)")
example = ("https://inkbunny.net/submissionsviewall.php"
"?text=&mode=unreadsubs&type=")

def __init__(self, match):
InkbunnyExtractor.__init__(self, match)
self.params = text.parse_query(match.group(1))

def posts(self):
params = self.params.copy()
params.pop("rid", None)
params.pop("mode", None)
params["unread_submissions"] = "yes"
return self.api.search(params)


class InkbunnySearchExtractor(InkbunnyExtractor):
"""Extractor for inkbunny search results"""
subcategory = "search"
Expand Down
3 changes: 3 additions & 0 deletions scripts/supportedsites.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@
"imgur": {
"favorite-folder": "Favorites Folders",
},
"inkbunny": {
"unread": "Unread Submissions",
},
"instagram": {
"posts": "",
"saved": "Saved Posts",
Expand Down
6 changes: 6 additions & 0 deletions test/results/inkbunny.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
"#class" : inkbunny.InkbunnyFavoriteExtractor,
},

{
"#url" : "https://inkbunny.net/submissionsviewall.php?rid=ffffffffff&mode=unreadsubs&page=1&orderby=unread_datetime",
"#category": ("", "inkbunny", "unread"),
"#class" : inkbunny.InkbunnyUnreadExtractor,
},

{
"#url" : "https://inkbunny.net/submissionsviewall.php?rid=ffffffffff&mode=search&page=1&orderby=create_datetime&text=cute&stringtype=and&keywords=yes&title=yes&description=no&artist=&favsby=&type=&days=&keyword_id=&user_id=&random=&md5=",
"#category": ("", "inkbunny", "search"),
Expand Down

0 comments on commit 2852404

Please sign in to comment.