Peach: Local-first video metadata scraper and media manager.
fix(follow): keep FANBOX updates when media is blocked
longmeidaodd068cebd10f
diff --git a/src/peach/follow_sources.py b/src/peach/follow_sources.pyindex 5a22528d7..c5077a1d0 100644--- a/src/peach/follow_sources.py+++ b/src/peach/follow_sources.py@@ -1266,7 +1266,14 @@ class FanboxConnector(_BaseConnector):post_id = str(post["id"])cover = post.get("cover") if isinstance(post.get("cover"), dict) else {}user = post.get("user") if isinstance(post.get("user"), dict) else {}- detail = self._post_detail(post_id)+ try:+ detail = self._post_detail(post_id)+ except FollowSourceError as error:+ # FANBOX 会把单篇 post.info 临时换成 Cloudflare 验证页。+ # 列表本身仍是可信的公开更新;保留卡片并明确标记媒体未取得,+ # 不能让一篇详情失败拖垮整个作者来源。+ detail = {"summary": "", "links": [], "images": (),+ "error": str(error)}probed += 1links = detail["links"]images = detail["images"]@@ -1286,6 +1293,7 @@ class FanboxConnector(_BaseConnector):group_hint=f"fanbox:{post_id}",extra={"fee_required": 0, "official": True, "links": links,"media_items": media_items,+ "media_error": detail.get("error"),"image_count": len(images),"gofile_video_count": sum(item.get("media_kind") == "video" for item in gofile_media)},diff --git a/src/peach/web_follow.py b/src/peach/web_follow.pyindex 92fcb19c4..3ddbc280c 100644--- a/src/peach/web_follow.py+++ b/src/peach/web_follow.py@@ -215,6 +215,7 @@ def _item_payload(item) -> dict:"status": item.status,"asset_id": item.asset_id,"media_needs_credential": bool(item.metadata.get("media_needs_credential")),+ "media_error": str(item.metadata.get("media_error") or "") or None,"has_media": bool(item.media_url) or bool(media_items),"media_kind": media_kind,"playable": (bool(item.media_url) or bool(media_items))diff --git a/tests/test_follow_sources.py b/tests/test_follow_sources.pyindex 8fd2bc0b3..93bdcc44c 100644--- a/tests/test_follow_sources.py+++ b/tests/test_follow_sources.py@@ -194,6 +194,16 @@ class OfficialConnectorTests(unittest.TestCase):self.assertEqual(gofile_request.headers["Authorization"], "Bearer secret")self.assertNotIn("secret", gofile_request.url)+ def test_one_blocked_detail_keeps_the_public_list_item(self):+ def route(request):+ if "post.info" in request.url:+ return HttpResponse(403, {}, b"challenge")+ return HttpResponse(200, {}, FANBOX_JSON)+ result = FanboxConnector(transport=_routed(route)).fetch("ffxivinitiala")+ self.assertEqual(len(result.candidates), 1)+ self.assertIn("HTTP 403", result.candidates[0].extra["media_error"])+ self.assertEqual(result.candidates[0].extra["media_items"], ())+def test_subscribestar_reads_public_profile_posts_without_login(self):result = SubscribeStarConnector(transport=_transport(body=SUBSCRIBESTAR_HTML)).fetch(diff --git a/web/app.js b/web/app.jsindex 11a1fdfa1..ddf63d12b 100644--- a/web/app.js+++ b/web/app.js@@ -1334,6 +1334,7 @@ function followVideoItems(group){}function followMediaNote(item){+ if(item.media_error)return `媒体未取得:${item.media_error}`;if(item.media_needs_credential)return '媒体链接需要 F95 登录会话解析';if(item.has_media&&!item.playable&&item.media_kind==='external')return item.resource_urls?.length?`已取得 ${item.resource_urls.length} 个外部文件页;视频列表未取得`