mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
fix(api): add getPlaylistDetail provider method for QQ playlist detail
The /playlist/:id/detail route was hardcoded to call the NetEase API path /playlist/detail on whatever provider was selected. For QQ this hit a non-existent path, so clicking into any QQ playlist showed "歌单不存在或加载失败". Replace the platform-specific hack in the route handler with a proper getPlaylistDetail method on MusicProvider. Implement it for NetEase (porting the existing /playlist/detail logic) and QQ (calling /getSongListDetail and reading from response.cdlist[0]). Pre-existing bug exposed by the QQ source tab. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e8d2f1ad98
commit
900191eca5
4 files changed
+50
-25
No files matched your search
@@ -3,6 +3,7 @@ import type {
|
||||
MusicProvider,
|
||||
Song,
|
||||
Playlist,
|
||||
PlaylistDetail,
|
||||
LyricLine,
|
||||
SearchResult,
|
||||
QrCodeResult,
|
||||
@@ -178,6 +179,21 @@ export class QQMusicProvider implements MusicProvider {
|
||||
}));
|
||||
}
|
||||
|
||||
async getPlaylistDetail(playlistId: string): Promise<PlaylistDetail | null> {
|
||||
const res = await this.api.get("/getSongListDetail", {
|
||||
params: { disstid: playlistId, ...this.cookieParams },
|
||||
});
|
||||
const cd = res.data?.response?.cdlist?.[0];
|
||||
if (!cd) return null;
|
||||
return {
|
||||
id: String(cd.disstid ?? cd.dissid ?? ""),
|
||||
name: cd.dissname ?? "",
|
||||
description: cd.desc ?? "",
|
||||
coverUrl: cd.logo ?? "",
|
||||
songCount: cd.songnum ?? cd.total_song_num ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
async getRecommendPlaylists(): Promise<Playlist[]> {
|
||||
const res = await this.api.get("/getSongLists", {
|
||||
params: { categoryId: 10000000, pageSize: 10, ...this.cookieParams },
|
||||
|
||||
Reference in new issue
Block a user