[fanbox] make 'comments' extraction non-fatal (#8814)

and fix a typo
This commit is contained in:
Mike Fährmann
2026-01-04 16:54:21 +01:00
parent 8e855bd810
commit a40dfc58d7

View File

@@ -151,9 +151,9 @@ class FanboxExtractor(Extractor):
post["plan"] = plans[fee] = plan post["plan"] = plans[fee] = plan
if self._meta_comments: if self._meta_comments:
if post.get("commentCount"): if post.get("commentCount"):
post["comments"] = list(self._get_comment_data(post["id"])) post["comments"] = self._get_comment_data(post["id"])
else: else:
post["commentd"] = () post["comments"] = ()
return content_body, post return content_body, post
@@ -208,12 +208,15 @@ class FanboxExtractor(Extractor):
"?limit=10&postId=" + post_id) "?limit=10&postId=" + post_id)
comments = [] comments = []
while url: try:
url = text.ensure_http_scheme(url) while url:
body = self.request_json(url, headers=self.headers)["body"] comlist = self.request_json(
data = body["commentList"] text.ensure_http_scheme(url), headers=self.headers,
comments.extend(data["items"]) )["body"]["commentList"]
url = data["nextUrl"] comments.extend(comlist["items"])
url = comlist["nextUrl"]
except Exception as exc:
self.log.debug("comments: %s: %s", exc.__class__.__name__, exc)
return comments return comments
def _get_urls_from_post(self, content_body, post): def _get_urls_from_post(self, content_body, post):