Peach: Local-first video metadata scraper and media manager.
fix(follow): f95zone 往回翻页报到底,不再静默重抓第一页
longmeidao0600f1712c7e
diff --git a/src/peach/follow_sources.py b/src/peach/follow_sources.pyindex fb6df202c..46999df04 100644--- a/src/peach/follow_sources.py+++ b/src/peach/follow_sources.py@@ -1255,6 +1255,12 @@ class F95ZoneConnector(_BaseConnector):thread = (ref or "").strip()if not self._THREAD_RE.match(thread):raise FollowSourceError(f"f95zone 的 ref 必须是线程 id,收到:{ref!r}")+ if page:+ # `/latest` 是站点自己渲染的「最近回复」聚合视图,没有 page-N 变体,+ # 这个连接器因此只有一页可读。以前这里把 `page` 静默丢掉,往回翻页会+ # 重新抓同一页、报成一次成功的检查,表现就是「点了没反应」。报到底+ # 比假装成功好:调用方据此显示历史已尽。+ raise FollowHistoryEnd("没有更多历史内容")url = f"https://f95zone.to/threads/{thread}/latest"headers = {"Accept": "text/html"}if self.credential and self.credential.values.get("cookie"):diff --git a/tests/test_follow_sources.py b/tests/test_follow_sources.pyindex 65a13b1af..a7dc61f7b 100644--- a/tests/test_follow_sources.py+++ b/tests/test_follow_sources.py@@ -751,6 +751,16 @@ class PagingBackTests(unittest.TestCase):self.assertNotIn("secret", result.request_url)self.assertNotIn("api_key", result.request_url)+ def test_f95zone_reports_the_end_of_history_instead_of_refetching_page_one(self):+ """`/latest` 只有一页。以前 `page` 被静默丢掉,往回翻会重新抓同一页并+ 报成一次成功检查——用户看到的就是「点了没反应」。"""+ seen = []+ with self.assertRaises(FollowHistoryEnd):+ F95ZoneConnector(+ transport=_transport(body=F95_HTML, record=seen)).fetch(+ "50685", page=1)+ self.assertEqual(seen, [], "报到底不该再打一次上游")+class F95ZoneConnectorTests(unittest.TestCase):@staticmethod