Skip to content

Commit

Permalink
fix: repair the playlist only supports the first 10 data
Browse files Browse the repository at this point in the history
  • Loading branch information
hq001 committed Dec 7, 2020
1 parent d80af17 commit d26e2ec
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/api/module/playlist_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,28 @@ module.exports = (query, request) => {
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
}).then(async (v) => {
const { body } = v
const { tracks, trackIds } = body.playlist
if (trackIds && tracks && trackIds.length > tracks.length) {
const ids = trackIds.slice(tracks.length).map((item) => item.id)
const data = {
c: '[' + ids.map((id) => '{"id":' + id + '}').join(',') + ']',
ids: '[' + ids.join(',') + ']',
}
const { body } = await request(
'POST',
`https://music.163.com/weapi/v3/song/detail`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
v.body.playlist.tracks = v.body.playlist.tracks.concat(body.songs)
}
return v
})
}

0 comments on commit d26e2ec

Please sign in to comment.