feat(fulfillment): 实时刷新斗鱼账号并支持租约时长设置

This commit is contained in:
yml
2026-11-18 10:59:20 +08:00
parent 0220ef995f
commit 9958e4ab7d
21 changed files with 1546 additions and 120 deletions
@@ -11,6 +11,27 @@ CHECK_UA = (
FISH_BALL_API = "https://www.douyu.com/wjapi/nc/exchange/fishBall"
USER_LEVEL_API = "https://www.douyu.com/japi/interactnc/web/userLevel/userLevelDetail"
AUTH_FAILURE_MARKERS = (
"登陆异常",
"登录异常",
"未登录",
"登陆失效",
"登录失效",
"重新登陆",
"重新登录",
"账户登陆",
)
def classify_douyu_cookie_result(result: dict) -> str:
"""把检测结果分成 valid / invalid / error,区分失效与暂时查不到。"""
if result.get("valid"):
return "valid"
message = str(result.get("message") or "")
if any(marker in message for marker in AUTH_FAILURE_MARKERS):
return "invalid"
return "error"
def check_douyu_cookie(cookie: str) -> dict:
"""检测斗鱼 Cookie 有效性,鱼丸与等级接口均通过才算有效。"""