1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-26 12:42:29 +01:00

[kemonoparty] restore discord pagination (#4676)

This commit is contained in:
Mike Fährmann 2023-10-19 21:57:27 +02:00
parent c9a976d8a6
commit 174191cb79
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 21 additions and 2 deletions

View File

@ -344,8 +344,15 @@ class KemonopartyDiscordExtractor(KemonopartyExtractor):
def posts(self): def posts(self):
url = "{}/api/v1/discord/channel/{}".format( url = "{}/api/v1/discord/channel/{}".format(
self.root, self.channel_id) self.root, self.channel_id)
params = {"skip": 0} params = {"o": 0}
return self.request(url, params=params).json()
while True:
posts = self.request(url, params=params).json()
yield from posts
if len(posts) < 150:
break
params["o"] += 150
class KemonopartyDiscordServerExtractor(KemonopartyExtractor): class KemonopartyDiscordServerExtractor(KemonopartyExtractor):

View File

@ -185,6 +185,18 @@ __tests__ = (
"date" : "type:datetime", "date" : "type:datetime",
}, },
{
"#url" : "https://kemono.party/discord/server/818188637329031199#818343747275456522",
"#comment" : "pagination",
"#category": ("", "kemonoparty", "discord"),
"#class" : kemonoparty.KemonopartyDiscordExtractor,
"#range" : "1-250",
"#count" : 250,
"channel" : "818343747275456522",
"channel_name": "wraith-sfw-gallery",
},
{ {
"#url" : "https://kemono.su/discord/server/256559665620451329/channel/462437519519383555#", "#url" : "https://kemono.su/discord/server/256559665620451329/channel/462437519519383555#",
"#category": ("", "kemonoparty", "discord"), "#category": ("", "kemonoparty", "discord"),