feat(xm): 喜马拉雅平台接入——匿名搜索/专辑/免费曲直链(hdaa xm-sign+AES-ECB 解密)、cookie 绑定解锁付费

This commit is contained in:
snowy-yang committed 2026-10-02 19:43:09 +08:00
1 parent 44852864e2
commit 5a9915b74c
8 files changed
+717

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
// 喜马拉雅(有声书/播客)平台模块
// 匿名可用面(2026-10-02 实测):搜索 / 专辑曲目 / 免费曲目取流(PC baseInfo 通道 + 解密直链)/ 封面。
// 付费与 VIP 内容:绑定登录 Cookie(POST /login/xm,须含 1&_token)后 baseInfo 授权放行;
// 超清(XimiUhq)需会员。有声内容不参与聚合搜索与跨平台匹配(sdk/index.ts 标记 noAggregate),
// 仅按 source=xm 直查。
import xmApi from '../apis/xm.ts'
import musicSearch from './musicSearch.ts'
import { getTrackInfo, coverUrl } from './musicInfo.ts'
import { getAlbumDetail } from './album.ts'
import { getCredentials } from '../auth/store.ts'
const xm = {
musicSearch,
getMusicUrl(songInfo, type) {
return xmApi.getMusicUrl(songInfo, type)
},
getPic(songInfo) {
return getTrackInfo(songInfo.songmid).then(coverUrl)
},
album: { getAlbumDetail },
getMusicDetailPageUrl(songInfo) {
return `https://www.ximalaya.com/sound/${songInfo.songmid}`
},
}
/** 登录状态(凭据存在性判断,无在线校验接口) */
export const status = () => {
const cred = getCredentials('xm') as { cookie?: string, updatedAt?: string } | null
return cred?.cookie
? { logged: true, updatedAt: cred.updatedAt }
: { logged: false }
}
export default xm