From 83bbb628d8368030c3fcf37346be2a586e1500e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 8 Sep 2021 00:32:49 +0200 Subject: [PATCH] [kemonoparty] add 'favorite' extractor (#1824) --- docs/supportedsites.md | 2 +- gallery_dl/extractor/kemonoparty.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 368a1712..19194c8e 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -382,7 +382,7 @@ Consider all sites to be NSFW unless otherwise known. Kemonoparty https://kemono.party/ - Posts, User Profiles + Favorites, Posts, User Profiles diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index a911d35b..75d17810 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -173,3 +173,20 @@ class KemonopartyPostExtractor(KemonopartyExtractor): def posts(self): posts = self.request(self.api_url).json() return (posts[0],) if len(posts) > 1 else posts + + +class KemonopartyFavoriteExtractor(KemonopartyExtractor): + """Extractor for kemono.party favorites""" + subcategory = "favorite" + pattern = r"(?:https?://)?kemono\.party/favorites" + test = ("https://kemono.party/favorites",) + + def items(self): + self._prepare_ddosguard_cookies() + users = self.request(self.root + "/api/favorites").json() + + for user in users: + user["_extractor"] = KemonopartyUserExtractor + url = "{}/{}/user/{}".format( + self.root, user["service"], user["id"]) + yield Message.Queue, url, user