[kemonoparty] fix 'comments' for posts without comments (#6415)
https://github.com/mikf/gallery-dl/issues/6415#issuecomment-2501966303
This commit is contained in:
@@ -90,12 +90,19 @@ class KemonopartyExtractor(Extractor):
|
|||||||
post["username"] = username
|
post["username"] = username
|
||||||
post["user_profile"] = profile
|
post["user_profile"] = profile
|
||||||
if comments:
|
if comments:
|
||||||
post["comments"] = self.api.creator_post_comments(
|
try:
|
||||||
service, creator_id, post["id"])
|
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 not None:
|
||||||
if dms is True:
|
if dms is True:
|
||||||
dms = self.api.creator_dms(
|
dms = self.api.creator_dms(
|
||||||
post["service"], post["user"])
|
post["service"], post["user"])
|
||||||
|
try:
|
||||||
|
dms = dms["props"]["dms"]
|
||||||
|
except Exception:
|
||||||
|
dms = ()
|
||||||
post["dms"] = dms
|
post["dms"] = dms
|
||||||
if announcements is not None:
|
if announcements is not None:
|
||||||
if announcements is True:
|
if announcements is True:
|
||||||
|
|||||||
@@ -123,12 +123,23 @@ __tests__ = (
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://kemono.su/patreon/user/34134344/post/38129255",
|
"#url" : "https://kemono.su/patreon/user/3161935/post/23445732",
|
||||||
"#comment" : "DMs (#2008)",
|
"#comment" : "comments (#2008)",
|
||||||
"#category": ("", "kemonoparty", "patreon"),
|
"#category": ("", "kemonoparty", "patreon"),
|
||||||
"#class" : kemonoparty.KemonopartyPostExtractor,
|
"#class" : kemonoparty.KemonopartyPostExtractor,
|
||||||
"#options" : {"dms": True},
|
"#options" : {"comments": True},
|
||||||
|
|
||||||
|
"comments": "len:12",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://kemono.su/patreon/user/34134344/post/38129255",
|
||||||
|
"#comment" : "DMs (#2008); no comments",
|
||||||
|
"#category": ("", "kemonoparty", "patreon"),
|
||||||
|
"#class" : kemonoparty.KemonopartyPostExtractor,
|
||||||
|
"#options" : {"dms": True, "comments": True},
|
||||||
|
|
||||||
|
"comments": (),
|
||||||
"dms": [
|
"dms": [
|
||||||
{
|
{
|
||||||
"added" : "2021-07-31T02:47:51.327865",
|
"added" : "2021-07-31T02:47:51.327865",
|
||||||
|
|||||||
Reference in New Issue
Block a user