Skip to content

Commit

Permalink
[kemonoparty] fix 'comments' for posts without comments (#6415)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 26, 2024
1 parent 74d855c commit 2162fa7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
11 changes: 9 additions & 2 deletions gallery_dl/extractor/kemonoparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,19 @@ def items(self):
post["username"] = username
post["user_profile"] = profile
if comments:
post["comments"] = self.api.creator_post_comments(
service, creator_id, post["id"])
try:
post["comments"] = self.api.creator_post_comments(
service, creator_id, post["id"])
except exception.HttpError:
post["comments"] = ()
if dms is not None:
if dms is True:
dms = self.api.creator_dms(
post["service"], post["user"])
try:
dms = dms["props"]["dms"]
except Exception:
dms = ()
post["dms"] = dms
if announcements is not None:
if announcements is True:
Expand Down
15 changes: 13 additions & 2 deletions test/results/kemonoparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,24 @@
"#count" : 3,
},

{
"#url" : "https://kemono.su/patreon/user/3161935/post/23445732",
"#comment" : "comments (#2008)",
"#category": ("", "kemonoparty", "patreon"),
"#class" : kemonoparty.KemonopartyPostExtractor,
"#options" : {"comments": True},

"comments": "len:12",
},

{
"#url" : "https://kemono.su/patreon/user/34134344/post/38129255",
"#comment" : "DMs (#2008)",
"#comment" : "DMs (#2008); no comments",
"#category": ("", "kemonoparty", "patreon"),
"#class" : kemonoparty.KemonopartyPostExtractor,
"#options" : {"dms": True},
"#options" : {"dms": True, "comments": True},

"comments": (),
"dms": [
{
"added" : "2021-07-31T02:47:51.327865",
Expand Down

0 comments on commit 2162fa7

Please sign in to comment.