mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
feat: add YesPlayMusic-style home page with daily recs, FM, and user playlists
Add backend endpoints for daily recommended songs, personal FM, user playlists, and playlist detail. Extend NeteaseProvider and MusicProvider interface with getDailyRecommendSongs and getUserPlaylists. Rewrite Home page with FM card, daily recommendations grid, and user playlists section. Fix Playlist view to fetch detail and songs from separate endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6b725f43f9
commit
67584d2622
5 files changed
+330
-16
No files matched your search
@@ -283,4 +283,39 @@ export class NeteaseProvider implements MusicProvider {
|
||||
platform: "netease",
|
||||
}));
|
||||
}
|
||||
|
||||
async getDailyRecommendSongs(): Promise<Song[]> {
|
||||
const res = await this.api.get("/recommend/songs", {
|
||||
params: { ...this.cookieParams },
|
||||
});
|
||||
return (res.data?.data?.dailySongs ?? []).map((s: any) => ({
|
||||
id: String(s.id),
|
||||
name: s.name,
|
||||
artist: (s.ar ?? []).map((a: any) => a.name).join(" / "),
|
||||
album: s.al?.name ?? "",
|
||||
duration: Math.round((s.dt ?? 0) / 1000),
|
||||
coverUrl: s.al?.picUrl ?? "",
|
||||
platform: "netease",
|
||||
}));
|
||||
}
|
||||
|
||||
async getUserPlaylists(): Promise<Playlist[]> {
|
||||
// First get user ID from login status
|
||||
const statusRes = await this.api.get("/login/status", {
|
||||
params: { ...this.cookieParams },
|
||||
});
|
||||
const uid = statusRes.data?.data?.profile?.userId;
|
||||
if (!uid) return [];
|
||||
|
||||
const res = await this.api.get("/user/playlist", {
|
||||
params: { uid, ...this.cookieParams },
|
||||
});
|
||||
return (res.data?.playlist ?? []).map((p: any) => ({
|
||||
id: String(p.id),
|
||||
name: p.name,
|
||||
coverUrl: p.coverImgUrl ?? "",
|
||||
songCount: p.trackCount ?? 0,
|
||||
platform: "netease",
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user