[fanbox] make '_extract_post()' non-fatal (#8711)

fixes regression introduced in 4a4c1a1154
This commit is contained in:
Mike Fährmann
2025-12-15 17:43:21 +01:00
parent d43ce45cb8
commit 9133ee321f
2 changed files with 46 additions and 6 deletions

View File

@@ -127,15 +127,19 @@ class FanboxExtractor(Extractor):
if file.get("extension", "").lower() in exts
]
post["date"] = self.parse_datetime_iso(post["publishedDatetime"])
try:
post["date"] = self.parse_datetime_iso(post["publishedDatetime"])
except Exception:
post["date"] = None
post["text"] = content_body.get("text") if content_body else None
post["isCoverImage"] = False
if self._meta_user:
post["user"] = self._get_user_data(post["creatorId"])
if self._meta_plan:
cid = post.get("creatorId")
if self._meta_user and cid is not None:
post["user"] = self._get_user_data(cid)
if self._meta_plan and cid is not None:
plans = self._get_plan_data(post["creatorId"])
fee = post["feeRequired"]
fee = post.get("feeRequired") or 0
try:
post["plan"] = plans[fee]
except KeyError:
@@ -146,7 +150,7 @@ class FanboxExtractor(Extractor):
plan["fee"] = fee
post["plan"] = plans[fee] = plan
if self._meta_comments:
if post["commentCount"]:
if post.get("commentCount"):
post["comments"] = list(self._get_comment_data(post["id"]))
else:
post["commentd"] = ()