新增歌曲楼层评论,歌手全部歌曲接口 #864, #867, 支持收藏VIP或付费歌曲到歌单 #860, 支持手动传入realIP #863

This commit is contained in:
binaryify
2020-08-09 17:37:55 +08:00
parent 9063c7dfc5
commit 324cd8b67e
6 changed files with 150 additions and 14 deletions
+17
View File
@@ -0,0 +1,17 @@
module.exports = (query, request) => {
query.cookie.os = 'pc'
const data = {
id: query.id,
private_cloud: 'true',
work_type: 1,
order: query.order || 'hot', //hot,time
offset: query.offset || 0,
limit: query.limit || 100,
}
return request('POST', `https://music.163.com/api/v1/artist/songs`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
+27
View File
@@ -0,0 +1,27 @@
module.exports = (query, request) => {
query.type = {
0: 'R_SO_4_', // 歌曲
1: 'R_MV_5_', // MV
2: 'A_PL_0_', // 歌单
3: 'R_AL_3_', // 专辑
4: 'A_DJ_1_', // 电台,
5: 'R_VI_62_', // 视频
}[query.type]
const data = {
parentCommentId: query.parentCommentId,
threadId: query.type + query.id,
time: query.time || -1,
limit: query.limit || 20,
}
return request(
'POST',
`https://music.163.com/api/resource/comment/floor/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
}
)
}
+43 -12
View File
@@ -1,20 +1,51 @@
// 收藏单曲到歌单 从歌单删除歌曲
module.exports = (query, request) => {
module.exports = async (query, request) => {
query.cookie.os = 'pc'
const tracks = query.tracks.split(',')
const data = {
op: query.op, // del,add
pid: query.pid, // 歌单id
trackIds: '[' + query.tracks + ']', // 歌曲id
trackIds: JSON.stringify(tracks), // 歌曲id
imme: 'true',
}
return request(
'POST',
`https://music.163.com/weapi/playlist/manipulate/tracks`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
try {
const res = await request(
'POST',
`http://music.163.com/api/playlist/manipulate/tracks`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
}
)
return {
status: 200,
body: {
...res,
},
}
)
} catch (error) {
if (error.body.code === 512) {
return request(
'POST',
`http://music.163.com/api/playlist/manipulate/tracks`,
{
op: query.op, // del,add
pid: query.pid, // 歌单id
trackIds: JSON.stringify([...tracks, ...tracks]),
imme: 'true',
},
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
}
)
}
}
}