[kemono] prevent fatal exception when retrieving profile data (#8382)

This commit is contained in:
Mike Fährmann
2025-10-10 17:18:12 +02:00
parent 3f8423aaaf
commit 2c0facde72
2 changed files with 25 additions and 3 deletions

View File

@@ -93,8 +93,13 @@ class KemonoExtractor(Extractor):
if creator_info is not None:
key = f"{service}_{creator_id}"
if key not in creator_info:
creator = creator_info[key] = self.api.creator_profile(
service, creator_id)
try:
creator = creator_info[key] = self.api.creator_profile(
service, creator_id)
except exception.HttpError:
self.log.warning("%s/%s/%s: 'Creator not found'",
service, creator_id, post["id"])
creator = creator_info[key] = util.NONE
else:
creator = creator_info[key]

View File

@@ -5,7 +5,7 @@
# published by the Free Software Foundation.
from gallery_dl.extractor import kemono
from gallery_dl import exception
from gallery_dl import util, exception
__tests__ = (
@@ -531,6 +531,23 @@ __tests__ = (
}],
},
{
"#url" : "https://kemono.cr/patreon/user/34792417/post/137409895",
"#comment" : "user profile data unavailable (#8382)",
"#category": ("", "kemono", "patreon"),
"#class" : kemono.KemonoPostExtractor,
"#log" : "patreon/34792417/137409895: 'Creator not found'",
"#results" : (
"https://kemono.cr/data/a9/87/a9874d7e1229396b0b2706fd7fa9949eac924e86256d84d077c10ecbace8bd17.bin",
"https://kemono.cr/data/a2/eb/a2eba02204086c789d59bc7112510aebf0428455ad1664153bfbb92eb8aa5643.jpg",
),
"title" : "Capella - Re:zero (20P)",
"user" : "34792417",
"user_profile": util.NONE,
"username" : util.NONE,
},
{
"#url" : "https://kemono.cr/discord/server/488668827274444803/608504710906904576",
"#category": ("", "kemono", "discord"),