refactor: 消除前端52处any类型+删除冗余requirements.txt+调试print改日志

- 删除 requirements.txt,pyproject.toml 为唯一依赖源(含 requests[socks] extra)
- core/geetest 下 5 处 print() 替换为 loguru logger.debug()
- api/modules.ts 新增 13 个响应接口,消除所有 api.xxx<any, any>
- 新建 utils/error.ts 提供 getErrorMessage(e: unknown) 安全取消息
- 11 个页面组件 catch (e: any) 改为 catch (e: unknown)
- useState<any[]>、columns: any[]、render 参数全部类型化
- TypeScript 类型检查零错误通过
This commit is contained in:
yml2213
2026-06-23 07:14:08 +08:00
parent 453a637480
commit 12c31c2e09
16 changed files with 305 additions and 189 deletions
+4 -8
View File
@@ -3,6 +3,7 @@ import requests
import json
import re
from typing import Mapping, Optional, Tuple
from loguru import logger
REQUEST_TIMEOUT = (10, 30)
PASSPORT_REFERER = "https://passport.douyu.com/"
@@ -263,13 +264,8 @@ def get_picture(gt:str, challenge:str) -> tuple[str, str, list[int], str, str, s
timeout=REQUEST_TIMEOUT,
)
response.raise_for_status()
print(response.text)
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']
@@ -317,12 +313,12 @@ def req_end(gt:str, challenge:str, w:str) -> dict:
timeout=REQUEST_TIMEOUT,
)
response.raise_for_status()
print(response.text)
logger.debug("极验 ajax.php 原始响应: {}", response.text[:500])
match = re.search(r'\((.*)\)$', response.text)
if match:
json_str = match.group(1)
data = json.loads(json_str)
print(f"极验验证响应: {data}")
logger.debug("极验验证响应: {}", data)
# 检查验证是否成功
if data.get('success') == 1: