feat(python): 完成 Python 全量迁移——剩余平台、登录通道与公共层修复

- 新增 5sing/apple/xm/me/qt/lr 平台包与取流实现(含 xm-sign、MissEvan 签名、蜻蜓 HMAC、Apple developer token)
- 新增 wy/kg/tx/lr 登录:扫码、手机号、账密(kg 20028 风控指纹)、cookie 绑定、kg/tx 续期
- request 层:保留多值 Set-Cookie;JSON body 紧凑化(修复 kg 网关验签);直连不经系统代理(对齐 Node)
- 登录路由统一 Body(embed=True),修复扫码轮询 422;lifespan 接入登录续期调度
- ruff/format/pyright 全绿;14 平台真实联网与 HTTP 路由验证通过
This commit is contained in:
snowy-yang committed 2026-10-23 21:55:45 +08:00
1 parent 800871ef6e
commit dfc06bf4de
182 files changed
+26620

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
"""QQ音乐热搜(移植自 sdk/tx/hotSearch.ts)。
musicu.fcg 的 tencent_musicsoso_hotkey.HotkeyService/GetHotkeyForQQMusicPC。
失败文案与原文一致:`获取热搜词失败`;重试上限 3 次(try max num)。
"""
from __future__ import annotations
from typing import Any
from app.sdk.common.request import http_fetch
from app.sdk.platforms.tx.utils import MUSICU_URL
def filter_list(raw_list: Any) -> list[str]:
return [str(item.get("query")) for item in raw_list or [] if isinstance(item, dict) and item.get("query")]
async def get_list(retry_num: int = 0) -> dict[str, Any]:
if retry_num > 2:
raise RuntimeError("try max num")
resp = await http_fetch(
MUSICU_URL,
method="post",
headers={"Referer": "https://y.qq.com/portal/player.html"},
body={
"comm": {
"ct": "19",
"cv": "1803",
"guid": "0",
"patch": "118",
"psrf_access_token_expiresAt": 0,
"psrf_qqaccess_token": "",
"psrf_qqopenid": "",
"psrf_qqunionid": "",
"tmeAppID": "qqmusic",
"tmeLoginType": 0,
"uin": "0",
"wid": "0",
},
"hotkey": {
"method": "GetHotkeyForQQMusicPC",
"module": "tencent_musicsoso_hotkey.HotkeyService",
"param": {"search_id": "", "uin": 0},
},
},
)
body = resp.body if isinstance(resp.body, dict) else {}
if resp.status_code != 200 or body.get("code") != 0:
raise RuntimeError("获取热搜词失败")
return {"source": "tx", "list": filter_list(((body.get("hotkey") or {}).get("data") or {}).get("vec_hotkey"))}