refactor: 补全services层+消除core/models.py冗余+修复network.py缩进错误
高优先级问题1 - Router层业务逻辑泄漏: - 新建 services/proxy_service.py: 从routers/proxy.py提取ProxyService类, 封装代理/白名单测试逻辑、全局状态管理、所有core/ import - 新建 services/account_service.py: 从routers/accounts.py提取 split_account_line、cookie_account_ids_query、parse_and_build_accounts, 封装core.douyu.email_verifier的import - 重写routers/proxy.py为薄HTTP/WS层,移除所有core/直接依赖 - 精简routers/accounts.py,从account_service导入业务函数 - 将_active_batches全局状态移入login_service.py的BatchRegistry类 - routers/login.py改为使用batch_registry单例 高优先级问题2 - 两套models.py冗余: - 删除core/models.py(Account dataclass + ProxyConfig死代码) - 在core/douyu/login.py新增AccountLike Protocol替代Account dataclass - login_service.py中Account(...)构造改为SimpleNamespace(...) - 清理core/__init__.py导出 附带修复: - core/geetest/common/network.py的get_picture()函数缩进错误 (缺少if match:块和data赋值语句)
This commit is contained in:
@@ -266,6 +266,10 @@ def get_picture(gt:str, challenge:str) -> tuple[str, str, list[int], str, str, s
|
||||
response.raise_for_status()
|
||||
logger.debug("极验 get.php 原始响应: {}", response.text[:500])
|
||||
match = re.search(r'\((.*)\)$', response.text)
|
||||
if match:
|
||||
json_str = match.group(1)
|
||||
data = json.loads(json_str)
|
||||
|
||||
if 'data' in data and isinstance(data['data'], dict):
|
||||
# 新版极验格式
|
||||
inner_data = data['data']
|
||||
|
||||
Reference in New Issue
Block a user