1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[kemonoparty] add 'favorite' extractor (#1824)

This commit is contained in:
Mike Fährmann 2021-09-08 00:32:49 +02:00
parent 35d75a4071
commit 83bbb628d8
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 18 additions and 1 deletions

View File

@ -382,7 +382,7 @@ Consider all sites to be NSFW unless otherwise known.
<tr>
<td>Kemonoparty</td>
<td>https://kemono.party/</td>
<td>Posts, User Profiles</td>
<td>Favorites, Posts, User Profiles</td>
<td></td>
</tr>
<tr>

View File

@ -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