
CodexandClaude Opus 4.7
f718dfe2e4
refactor(fudai_attend): 抽 1057 行粉丝团门槛分支到 fansclub_handler (1629 → 573)
attend_choujiang 中"加入粉丝团/粉丝团"按钮分支占 1057 行,含一个 751 行的
内嵌闭包 _recover_to_fudai_detail_after_fansclub 处理"加入页"恢复。该分支
是文件中最大的单一逻辑块,独立性高(没有共享主流程的局部变量,全靠 analyser
属性传递状态)。
新建 fudai_attend_pkg/fansclub_handler.py(1070 行)作为整段抽出后的目的地。
导出顶层函数 handle_fansclub_branch(analyser, attend_button_text) -> bool。
attend_choujiang 中原 elif 块替换为 4 行委托:
elif attend_button_text and (
"加入粉丝团" in attend_button_text or "粉丝团" in attend_button_text
):
return handle_fansclub_branch(analyser, attend_button_text)
行为完全保留:
- 设置 analyser.last_attend_fail_reason = "fansclub_required"
- 第一步点参与按钮 (543, 2070)
- 第二步 OCR 找加入粉丝团按钮 + bbox 中心点击(fallback 区域中心)
- 第三步关闭详情页 (500, 470)
- 第四步根据 auto_join_fansclub 等待
- 第五步 _recover_to_fudai_detail_after_fansclub 在加入页再点击 + 返回直播间
新增 9 个单元测试覆盖:
- 总返回 True
- 设置 fail_reason = "fansclub_required"
- 必经的两次坐标点击 (543,2070) / (500,470)
- 截图缺失/OCR 抛异常时的兜底
- auto_join 启用/禁用分支
1313 passed (+9)。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 02:05:38 +08:00
..
2026-05-21 14:09:02 +08:00
2026-05-21 15:02:08 +08:00
2026-05-21 22:21:03 +08:00
2026-05-21 14:45:49 +08:00
2026-05-21 22:15:34 +08:00
2026-05-23 01:30:35 +08:00
2026-05-23 00:47:02 +08:00
2026-05-23 01:47:36 +08:00
2026-05-21 22:03:35 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 14:09:02 +08:00
2026-05-23 02:05:38 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 22:42:58 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 21:53:47 +08:00
2026-05-21 21:01:15 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 22:38:43 +08:00
2026-05-21 22:07:15 +08:00
2026-05-21 22:00:02 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 14:15:14 +08:00
2026-05-22 22:18:33 +08:00
2026-05-21 21:25:50 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 21:50:02 +08:00
2026-05-23 01:39:24 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 22:24:15 +08:00
2026-05-21 14:09:02 +08:00
2026-05-22 20:16:37 +08:00
2026-05-22 19:08:09 +08:00
2026-05-21 14:45:49 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 21:56:43 +08:00
2026-05-21 21:01:15 +08:00
2026-05-21 14:09:02 +08:00
2026-05-23 01:58:13 +08:00
2026-05-21 21:42:39 +08:00
2026-05-21 22:12:54 +08:00
2026-05-21 15:11:54 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 14:56:56 +08:00
2026-05-22 20:46:23 +08:00
2026-05-21 20:54:35 +08:00
2026-05-22 19:20:29 +08:00
2026-05-21 21:04:14 +08:00
2026-05-21 14:25:35 +08:00
2026-05-21 20:54:35 +08:00
2026-05-22 01:22:56 +08:00
2026-05-21 22:09:35 +08:00
2026-05-22 22:45:51 +08:00
2026-05-23 01:21:27 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 22:28:26 +08:00
2026-05-21 22:17:54 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 21:37:19 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 22:45:46 +08:00
2026-05-21 14:09:02 +08:00
2026-05-21 15:17:56 +08:00
2026-05-21 20:54:35 +08:00
2026-05-21 14:09:02 +08:00
2026-05-23 01:02:48 +08:00
2026-05-22 19:32:04 +08:00
2026-05-21 22:48:38 +08:00
2026-05-21 20:54:35 +08:00