forked from Binaryify/NeteaseCloudMusicApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_new.js
48 lines (47 loc) · 1.1 KB
/
comment_new.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
37
38
39
40
41
42
43
44
45
46
47
48
const { resourceTypeMap } = require('../util/config.json')
// 评论
module.exports = (query, request) => {
query.cookie.os = 'pc'
query.type = resourceTypeMap[query.type]
const threadId = query.type + query.id
const pageSize = query.pageSize || 20
const pageNo = query.pageNo || 1
let sortType = Number(query.sortType) || 99
if (sortType === 1) {
sortType = 99
}
let cursor = ''
switch (sortType) {
case 99:
cursor = (pageNo - 1) * pageSize
break
case 2:
cursor = 'normalHot#' + (pageNo - 1) * pageSize
break
case 3:
cursor = query.cursor || '0'
break
default:
break
}
const data = {
threadId: threadId,
pageNo,
showInner: query.showInner || true,
pageSize,
cursor: cursor,
sortType: sortType, //99:按推荐排序,2:按热度排序,3:按时间排序
}
return request(
'POST',
`https://music.163.com/api/v2/resource/comments`,
data,
{
crypto: 'eapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
url: '/api/v2/resource/comments',
},
)
}