mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-23 16:11:24 +08:00
@@ -0,0 +1,31 @@
|
||||
// 通过传过来的歌单id拿到所有歌曲数据
|
||||
// 支持传递参数limit来限制获取歌曲的数据数量 例如: /playlist/track/all?id=7044354223&limit=10
|
||||
|
||||
const createOption = require('../util/option.js')
|
||||
module.exports = (query, request) => {
|
||||
const data = {
|
||||
id: query.id,
|
||||
n: 100000,
|
||||
s: query.s || 8,
|
||||
}
|
||||
//不放在data里面避免请求带上无用的数据
|
||||
let limit = parseInt(query.limit) || 1000
|
||||
let offset = parseInt(query.offset) || 0
|
||||
|
||||
return request(`/api/v6/playlist/detail`, data, createOption(query)).then(
|
||||
(res) => {
|
||||
let trackIds = res.body.playlist.trackIds
|
||||
let idsData = {
|
||||
c:
|
||||
'[' +
|
||||
trackIds
|
||||
.slice(offset, offset + limit)
|
||||
.map((item) => '{"id":' + item.id + '}')
|
||||
.join(',') +
|
||||
']',
|
||||
}
|
||||
|
||||
return request(`/api/v3/song/detail`, idsData, createOption(query))
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user