四个主流平台从「搜索 + 取流」补到能力对齐,新增 playlist/parse (tx、wy 另加 userPlaylist),顺带修掉酷我直链的一个真实缺陷。 - kw:酷我 CDN 回吐的 query 用 `$` 顶替 `=`(`?bitrate$320&format$mp3…`), `$` 非 URL 标准分隔符,播放器与解析器普遍不认,导致拿到直链也放不出声; 统一还原成 `=` 再对外返回 - wy:补齐 album/playlist/parse/userPlaylist,与 kg/tx 能力对齐 - kg/kw/tx:接入 parse(跨平台精确匹配的输入源)与歌单 为什么单独一次提交:这批改动不动架构,只做能力补齐与 URL 规范化, 与新增平台的注册表改动分开,出问题时便于单独回滚。
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import leaderboard from './leaderboard.ts'
|
|
import kgApi from '../apis/kg.ts'
|
|
import songList from './songList.ts'
|
|
import musicSearch from './musicSearch.ts'
|
|
import pic from './pic.ts'
|
|
import lyric from './lyric.ts'
|
|
import hotSearch from './hotSearch.ts'
|
|
import comment from './comment.ts'
|
|
import singer from './singer.ts'
|
|
import album from './album.ts'
|
|
import playlist from './playlist.ts'
|
|
import parse from './parse.ts'
|
|
import { registerDfid } from '../auth/kg.ts'
|
|
|
|
const kg = {
|
|
// 启动时注册正式 dfid(幂等;随机 dfid 匿名取流易撞 20028 验证,注册后显著降低)
|
|
async init() {
|
|
await registerDfid().catch((err: any) => console.log(`[kg/init] dfid 注册跳过: ${err.message}`))
|
|
},
|
|
leaderboard,
|
|
songList,
|
|
musicSearch,
|
|
hotSearch,
|
|
comment,
|
|
singer,
|
|
album,
|
|
playlist,
|
|
parse,
|
|
getMusicUrl(songInfo, type) {
|
|
return kgApi.getMusicUrl(songInfo, type)
|
|
},
|
|
getLyric(songInfo) {
|
|
return lyric.getLyric(songInfo)
|
|
},
|
|
getPic(songInfo) {
|
|
return pic.getPic(songInfo)
|
|
},
|
|
getMusicDetailPageUrl(songInfo) {
|
|
return `https://www.kugou.com/song/#hash=${songInfo.hash}&album_id=${songInfo.albumId}`
|
|
},
|
|
}
|
|
|
|
export default kg
|