支持跳过斗鱼手机号绑定并优化标签筛选

This commit is contained in:
yml2213
2026-08-07 22:07:39 +08:00
parent 535fcbb257
commit a67d144b78
4 changed files with 163 additions and 10 deletions
+43 -1
View File
@@ -112,4 +112,46 @@ class LoginAPIStrategy(ABC):
Returns:
登录回调 URL
"""
return payload.get('data', {}).get('url', '')
data = payload.get('data', {})
if not isinstance(data, dict):
return ''
# `remoteLogin` 与“跳过绑定手机号”完成后都会返回同类回调地址,
# 但不同版本接口的字段命名不完全一致。
for key in ('url', 'loginUrl', 'login_url', 'redirectUrl', 'redirect_url'):
value = data.get(key)
if isinstance(value, str) and value:
return value
return ''
def extract_mobile_bind_unique_key(self, payload: dict) -> str:
"""提取服务端要求绑定手机号时返回的一次性继续登录标识。"""
data = payload.get('data', {})
if not isinstance(data, dict):
return ''
def find_unique_key(value: object) -> str:
if isinstance(value, dict):
unique_key = value.get('uniqueKey') or value.get('unique_key')
if isinstance(unique_key, str) and unique_key:
return unique_key
for child in value.values():
result = find_unique_key(child)
if result:
return result
elif isinstance(value, (list, tuple)):
for child in value:
result = find_unique_key(child)
if result:
return result
return ''
return find_unique_key(data)
def build_skip_mobile_bind_data(self, unique_key: str) -> dict:
"""构建跳过手机号绑定、继续完成网页登录的请求参数。"""
return {
'type': '3',
'uniqueKey': unique_key,
'biz_type': '1',
}