feat(captcha): 增加全题型图片落盘、字形一致性强校验与防秒换拟人交互机制
- 题目图片自动下载: 所有题型原图统一落盘至 scratch/captcha_debug,文字点选自动生成带编号红圈标注图便于肉眼核验 - 字形严格一致性校验: 在 SolveResult 增加 text_match_ok 检查,对图字不符或混淆干扰题直接拒答换题,避免错答引发 errorCode=12 - 防秒换与拟人延时: 遇到非预期题目换题等待 2.8~4.2s (对齐 HAR 真实抓包),求解失败等待 2.5~3.8s,作答前模拟交互 5.5~7.5s - 代理容错增强: 在 OneMsAdapter 捕获代理断流与鉴权异常,支持动态轮换新代理重试
This commit is contained in:
@@ -64,8 +64,18 @@ def parse_proxies(payload: str, scheme: str = "http") -> List[str]:
|
||||
|
||||
def fetch_proxy(api_url: str, scheme: str = "http", timeout: float = 15.0) -> Optional[str]:
|
||||
"""调用代理提取 API 并返回第一个可用代理字符串, 例如 http://1.2.3.4:8080"""
|
||||
import logging
|
||||
_log = logging.getLogger("proxy")
|
||||
resp = httpx.get(api_url, timeout=timeout, trust_env=False, follow_redirects=True)
|
||||
proxies = parse_proxies(resp.text, scheme=scheme)
|
||||
if not proxies:
|
||||
try:
|
||||
import json
|
||||
err = json.loads(resp.text)
|
||||
if "info" in err or "message" in err:
|
||||
_log.error("代理 API 返回失败: %s", err.get("info") or err.get("message"))
|
||||
except Exception:
|
||||
pass
|
||||
return proxies[0] if proxies else None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user