Skip to content

Commit

Permalink
[kemonoparty:discord] provide a 'channel_name'
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 15, 2021
1 parent 28bdd58 commit 003f259
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gallery_dl/extractor/kemonoparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ def posts(self):
class KemonopartyDiscordExtractor(KemonopartyExtractor):
"""Extractor for kemono.party discord servers"""
subcategory = "discord"
directory_fmt = ("{category}", "discord", "{server}", "{channel}")
directory_fmt = ("{category}", "discord", "{server}",
"{channel_name|channel}")
filename_fmt = "{id}_{num:>02}_{filename}.{extension}"
archive_fmt = "discord_{server}_{id}_{num}"
pattern = r"(?:https?://)?kemono\.party/discord/server/(\d+)"
Expand Down Expand Up @@ -240,13 +241,17 @@ def posts(self):
for channel in self.request(url).json():
url = "{}/api/discord/channel/{}".format(self.root, channel["id"])
params = {"skip": 0}
channel_name = channel["name"]

while True:
posts = self.request(url, params=params).json()
yield from posts

for post in posts:
post["channel_name"] = channel_name
yield post

if len(posts) < 25:
return
break
params["skip"] += 25


Expand Down

0 comments on commit 003f259

Please sign in to comment.