fix(netease): use eapi for playlist track details

This commit is contained in:
yhxglsa2016 committed 2026-11-28 11:51:20 +08:00
1 parent 0b3bb0c3dd
commit 11081ec4f8
2 files changed
+8 -3

No files matched your search

+1 -1
View File
@@ -262,7 +262,7 @@ describe("NeteaseProvider.getPlaylistSongs (#200)", () => {
expect(post).toHaveBeenCalledTimes(Math.ceil(size / 1000));
for (let offset = 0; offset < size; offset += 1000) {
expect(post).toHaveBeenNthCalledWith(offset / 1000 + 1, "/song/detail", {
ids: ids.slice(offset, offset + 1000).join(","), cookie: "MUSIC_U=test",
ids: ids.slice(offset, offset + 1000).join(","), cookie: "MUSIC_U=test", crypto: "eapi",
}, { headers: { "x-apicache-bypass": "1" } });
}
});
+7 -2
View File
@@ -368,8 +368,13 @@ export class NeteaseProvider implements MusicProvider {
const songs: Song[] = [];
for (let offset = 0; offset < trackIds.length; offset += batchSize) {
const ids = trackIds.slice(offset, offset + batchSize).map(track => String(track.id));
// The sidecar's URL-based cache cannot distinguish POST bodies.
const details = await this.api.post("/song/detail", { ids: ids.join(","), ...cookie }, {
const details = await this.api.post("/song/detail", {
ids: ids.join(","),
// Match /playlist/track/all's detail lookup; /song/detail defaults to weapi.
crypto: "eapi",
...cookie,
}, {
// The sidecar's URL-based cache cannot distinguish POST bodies.
headers: { "x-apicache-bypass": "1" },
});
if (!Array.isArray(details.data?.songs)) throw new Error("网易云返回的歌曲详情无效");