forked from Binaryify/NeteaseCloudMusicApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.js
36 lines (34 loc) · 850 Bytes
/
comment.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const { resourceTypeMap } = require('../util/config.json')
// 发送与删除评论
module.exports = (query, request) => {
query.cookie.os = 'pc'
query.t = {
1: 'add',
0: 'delete',
2: 'reply',
}[query.t]
query.type = resourceTypeMap[query.type]
const data = {
threadId: query.type + query.id,
}
if (query.type == 'A_EV_2_') {
data.threadId = query.threadId
}
if (query.t == 'add') data.content = query.content
else if (query.t == 'delete') data.commentId = query.commentId
else if (query.t == 'reply') {
data.commentId = query.commentId
data.content = query.content
}
return request(
'POST',
`https://music.163.com/weapi/resource/comments/${query.t}`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}