Files
douyin_guaji-main/douyin/stage
CodexandClaude Opus 4.7 e737002b1e refactor(stage): 抽 "不在直播间" OCR 检测分支到 ocr_detection (1245 → 807)
diagnose_stage_from_current_screen L336-774 是 438 行 "if not in_live_room:"
分支:
- 步骤 2.5:购物红包 OCR 复查(像素命中红包背景时再用 OCR 二次确认)
- 步骤 3:OCR 推荐页/关注列表/直播列表标签栏(含两次精确确认子流程)

抽到 douyin_stage_handler_pkg/ocr_detection.py:
- detect_pages_via_ocr(...) 入口,内部化 in_live_room 检查
- _check_redpacket_ocr_when_not_in_live_room 步骤 2.5
- _confirm_follow_list 关注列表精确截图 + OCR 模式 0/1
- _confirm_live_list 直播列表精确截图 + OCR 模式 0/1

返回 Optional[Tuple[str, str]]:
- ("RECOMMEND_PAGE"/"FOLLOW_LIST"/"LIVE_LIST"/"SHOPPING_REDPACKET_POPUP"
   /"IN_LIVE_ROOM", reason) → caller 立即 return
- None → in_live_room=True,caller 继续后续逻辑

主函数对应位置替换为 17 行委托,_log/_log_summary/_log_separator 通过
参数传入,保持日志格式完全一致。

1361 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 02:59:02 +08:00
..