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:
1 parent
800871ef6e
commit
dfc06bf4de
182 files changed
+26620
No files matched your search
@@ -0,0 +1,65 @@
|
||||
"""蜻蜓FM 平台模块(对应 sdk/qt/index.ts)。
|
||||
|
||||
匿名可用面(2026-10-02 实测):搜索(官网 SSR 解析)/ 频道节目列表(SSR)/
|
||||
免费节目点播直链(audiostream 签名 302 到华为云 CDN)。
|
||||
|
||||
搜索结果为频道(专辑)级条目,songmid=channelId;节目条目 songmid="<channelId>:<programId>"。
|
||||
付费节目与直播电台签名(Lwrpu$K5oP)暂未接登录。有声内容不参与聚合(noAggregate)。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from app.sdk.platforms._base import Platform
|
||||
from app.sdk.platforms.qt import album, music_search
|
||||
|
||||
|
||||
async def _get_music_url(song_info: dict[str, Any], quality: str, retry_num: int = 0) -> dict[str, Any]:
|
||||
from app.sdk.apis.qt import get_music_url
|
||||
|
||||
return await get_music_url(song_info, quality, retry_num)
|
||||
|
||||
|
||||
async def get_pic(song_info: dict[str, Any]) -> str | None:
|
||||
"""搜索结果已带封面;频道详情页无独立封面接口,降级用 SSR 页 og:image。"""
|
||||
channel_id = str(song_info.get("songmid") or "").split(":")[0]
|
||||
return await album.get_channel_og_image(channel_id)
|
||||
|
||||
|
||||
async def get_album_detail(channel_id: str, page: int = 1, limit: int = 20) -> dict[str, Any]:
|
||||
del page, limit # SSR 页一次吐出全部节目,与上游一致不分页
|
||||
result = await album.get_channel_programs(channel_id)
|
||||
songs = result["list"]
|
||||
return {
|
||||
"info": {"name": result["name"], "total": len(songs)},
|
||||
"list": songs,
|
||||
"total": len(songs),
|
||||
"limit": len(songs),
|
||||
"allPage": 1,
|
||||
"source": "qt",
|
||||
}
|
||||
|
||||
|
||||
class _QtAlbum:
|
||||
get_album_detail = staticmethod(get_album_detail)
|
||||
|
||||
|
||||
def get_music_detail_page_url(song_info: dict[str, Any]) -> str:
|
||||
parts = str(song_info.get("songmid") or "").split(":")
|
||||
channel_id = parts[0] if parts else ""
|
||||
program_id = parts[1] if len(parts) > 1 else ""
|
||||
if program_id:
|
||||
return f"https://www.qingting.fm/channels/{channel_id}/programs/{program_id}"
|
||||
return f"https://www.qingting.fm/channels/{channel_id}"
|
||||
|
||||
|
||||
MODULE = Platform(
|
||||
id="qt",
|
||||
name="蜻蜓FM",
|
||||
music_search=music_search,
|
||||
album=_QtAlbum,
|
||||
get_music_url=_get_music_url,
|
||||
get_pic=get_pic,
|
||||
get_music_detail_page_url=get_music_detail_page_url,
|
||||
)
|
||||
Reference in new issue
Block a user