From 2852404e4949d8c54a401c720f7b4f216692b4be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 15 Dec 2023 21:20:12 +0100 Subject: [PATCH] [inkbunny] add 'unread' extractor (#4934) --- docs/supportedsites.md | 2 +- gallery_dl/extractor/inkbunny.py | 20 ++++++++++++++++++++ scripts/supportedsites.py | 3 +++ test/results/inkbunny.py | 6 ++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 9ef1fd0955..e3b4ea7ef5 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -400,7 +400,7 @@ Consider all listed sites to potentially be NSFW. Inkbunny https://inkbunny.net/ - Favorites, Followed Users, Pools, Posts, Search Results, User Profiles + Favorites, Followed Users, Pools, Posts, Search Results, Unread Submissions, User Profiles Supported diff --git a/gallery_dl/extractor/inkbunny.py b/gallery_dl/extractor/inkbunny.py index 7076dfec8e..c52e3570aa 100644 --- a/gallery_dl/extractor/inkbunny.py +++ b/gallery_dl/extractor/inkbunny.py @@ -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" diff --git a/scripts/supportedsites.py b/scripts/supportedsites.py index a0856f0090..2a625e7680 100755 --- a/scripts/supportedsites.py +++ b/scripts/supportedsites.py @@ -192,6 +192,9 @@ "imgur": { "favorite-folder": "Favorites Folders", }, + "inkbunny": { + "unread": "Unread Submissions", + }, "instagram": { "posts": "", "saved": "Saved Posts", diff --git a/test/results/inkbunny.py b/test/results/inkbunny.py index 7129877ec7..58cecb68a0 100644 --- a/test/results/inkbunny.py +++ b/test/results/inkbunny.py @@ -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"),