forked from Binaryify/NeteaseCloudMusicApi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c37439
commit 96f84b0
Showing
3 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,3 @@ | ||
// 全部歌单分类 | ||
|
||
module.exports = (query, request) => { | ||
return request( | ||
'POST', | ||
`https://music.163.com/weapi/playlist/catalogue`, | ||
{}, | ||
{ | ||
crypto: 'weapi', | ||
cookie: query.cookie, | ||
proxy: query.proxy, | ||
realIP: query.realIP, | ||
}, | ||
) | ||
} | ||
module.exports = (query, request) => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 通过传过来的歌单id拿到所有歌曲数据 | ||
// 支持传递参数limit来限制获取歌曲的数据数量 例如: /playlist/track/all?id=7044354223&limit=10 | ||
|
||
module.exports = (query, request) => { | ||
const data = { | ||
id: query.id, | ||
n: 100000, | ||
s: query.s || 8, | ||
} | ||
//不放在data里面避免请求带上无用的数据 | ||
let limit = query.limit | ||
let trackIds | ||
let idsData = Object.create(null) | ||
|
||
return request('POST', `https://music.163.com/api/v6/playlist/detail`, data, { | ||
crypto: 'api', | ||
cookie: query.cookie, | ||
proxy: query.proxy, | ||
realIP: query.realIP, | ||
}).then((res) => { | ||
const ids = [] | ||
let trackIds = res.body.playlist.trackIds | ||
if (typeof limit === 'undefined') { | ||
limit = trackIds.length | ||
} | ||
trackIds.forEach((item, index) => { | ||
if (index < limit) { | ||
ids.push(item.id) | ||
} | ||
}) | ||
idsData = { | ||
c: '[' + ids.map((id) => '{"id":' + id + '}').join(',') + ']', | ||
} | ||
|
||
return request( | ||
'POST', | ||
`https://music.163.com/api/v3/song/detail`, | ||
idsData, | ||
{ | ||
crypto: 'weapi', | ||
cookie: query.cookie, | ||
proxy: query.proxy, | ||
realIP: query.realIP, | ||
}, | ||
) | ||
}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.