mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-12-01 02:12:50 +08:00
fix(netease): use eapi for playlist track details
This commit is contained in:
2 files changed
+8
-3
No files matched your search
@@ -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" } });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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("网易云返回的歌曲详情无效");
|
||||
|
||||
Reference in new issue
Block a user