diff --git a/gallery_dl/extractor/fanbox.py b/gallery_dl/extractor/fanbox.py index 69315938..036b3884 100644 --- a/gallery_dl/extractor/fanbox.py +++ b/gallery_dl/extractor/fanbox.py @@ -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"] = () diff --git a/test/results/fanbox.py b/test/results/fanbox.py index 0db8ee58..359c69fc 100644 --- a/test/results/fanbox.py +++ b/test/results/fanbox.py @@ -190,6 +190,42 @@ __tests__ = ( ], }, +{ + "#url" : "https://etlabsotwe.fanbox.cc/posts/11070192", + "#comment" : "(potentially?) missing 'publishedDatetime' (#8711)", + "#class" : fanbox.FanboxPostExtractor, + "#results" : "https://pixiv.pximg.net/fanbox/public/images/post/11070192/cover/MGoWoTnJphuJSkD3owo3r7wG.jpeg", + + "archives" : (), + "creatorId" : "etlabsotwe", + "date" : "dt:2025-12-15 11:31:50", + "excerpt" : "", + "extension" : "jpeg", + "feeRequired" : 200, + "fileUrl" : "https://pixiv.pximg.net/fanbox/public/images/post/11070192/cover/MGoWoTnJphuJSkD3owo3r7wG.jpeg", + "filename" : "MGoWoTnJphuJSkD3owo3r7wG", + "hasAdultContent": True, + "id" : "11070192", + "imageForShare" : "https://pixiv.pximg.net/c/1200x630_90_a2_g5/fanbox/public/images/post/11070192/cover/MGoWoTnJphuJSkD3owo3r7wG.jpeg", + "isCommentingRestricted": False, + "isCoverImage" : True, + "isLiked" : False, + "isPinned" : False, + "isRestricted" : True, + "likeCount" : int, + "num" : 0, + "publishedDatetime": "2025-12-15T20:31:50+09:00", + "tags" : [], + "text" : None, + "title" : "Sketches 2025-12-15", + "type" : "article", + "updatedDatetime": "iso:dt", + "user" : { + "name" : "ET", + "userId" : "74814193", + }, +}, + { "#url" : "https://fanbox.cc/", "#category": ("", "fanbox", "home"),