Skip to content

Commit

Permalink
v3.5.0 增加获取动态评论接口,增加点赞和评论对动态的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryify committed Mar 14, 2019
1 parent 01497fc commit 812640e
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# 更新日志
### 3.5.0 | 2019.03.14
- 增加获取动态评论接口

- 支持给动态点赞

- 支持给动态评论点赞

- 支持给动态发送/删除评论

### 3.4.0 | 2019.01.29
- 增加已收藏专辑列表接口

Expand Down
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
91. 听歌打卡
92. 获取视频标签下的视频
93. 已收藏专辑列表
94. 获取动态评论

## 环境要求

Expand Down
32 changes: 31 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
91. 听歌打卡
92. 获取视频标签下的视频
93. 已收藏专辑列表
94. 获取动态评论

## 安装

Expand Down Expand Up @@ -432,6 +433,16 @@ tags:歌单tag

**调用例子 :** `/user/event?uid=32953014`

### 获取动态评论

说明 : 登陆后调用此接口 , 可以获取动态下评论

**必选参数 :** `threadId` : 动态 id,可通过 `/event``/user/event` 接口获取

**接口地址 :** `/event/comments`

**调用例子 :** `/event/comments?threadId=A_EV_2_6559519868_32953014`

### 关注/取消关注用户

说明 : 登陆后调用此接口 , 传入用户 id, 和操作 t,可关注/取消关注用户
Expand Down Expand Up @@ -972,12 +983,17 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
4: 电台
5: 视频
6: 动态
```

**接口地址 :** `comment/like`

**调用例子 :** `/comment/like?id=29178366&cid=12840183&t=1&type=0` 对应给 [https://music.163.com/#/song?id=29178366](https://music.163.com/#/song?id=29178366) 最热门的评论点赞


注意: 动态点赞不需要传入 id 参数,需要传入动态的 `threadId` 参数,如:`/comment/like?type=6&cid=1419532712&threadId=A_EV_2_6559519868_32953014&t=0``threadId` 可通过 `/event``/user/event` 接口获取

### 发送/删除评论

说明 : 调用此接口,可发送评论或者删除评论
Expand All @@ -1004,6 +1020,8 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
4: 电台
5: 视频
6: 动态
```

`id`:对应资源 id
Expand All @@ -1012,6 +1030,8 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具

**调用例子** : `/comment?t=1&type=1&id=5436712&content=test` (往广岛之恋 mv 发送评论: test)

注意:如给动态发送评论,则不需要传 id,需要传动态的 `threadId`,如:`/comment?t=1&type=6&threadId=A_EV_2_6559519868_32953014&content=test`

2. 删除评论

**必选参数**
Expand All @@ -1033,13 +1053,18 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
5: 视频
6: 动态
```

`id`:对应资源 id
`content` :内容 id,可通过 `/comment/mv` 等接口获取

**调用例子** : `/comment?t=0&type=1&id=5436712&commentId=1535550516319` (在广岛之恋 mv 删除评论)
```


注意:如给动态删除评论,则不需要传 id,需要传动态的 `threadId`,如:`/comment?t=0&type=6&threadId=A_EV_2_6559519868_32953014&commentId=1419516382`


### banner
Expand All @@ -1064,6 +1089,8 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
4: 电台
5: 视频
6: 动态
```

`t`: 操作,1 为点赞,其他未取消点赞
Expand All @@ -1074,6 +1101,9 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具

**调用例子 :** `/resource/like?t=1&type=1&id=5436712`

注意:如给动态点赞,不需要传入 id,需要传入 `threadId`,可通过 `event`,`/user/event` 接口获取,如:
`/resource/like?t=1&type=6&threadId=A_EV_2_6559519868_32953014`

### 获取歌曲详情

说明 : 调用此接口 , 传入音乐 id(支持多个 id, 用 `,` 隔开), 可获得歌曲详情(注意:歌曲封面现在需要通过专辑内容接口获取)
Expand Down
7 changes: 6 additions & 1 deletion module/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ module.exports = (query, request) => {
2: 'A_PL_0_', // 歌单
3: 'R_AL_3_', // 专辑
4: 'A_DJ_1_', // 电台,
5: 'R_VI_62_' // 视频
5: 'R_VI_62_',// 视频
6: 'A_EV_2_' // 动态
}[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')
Expand Down
6 changes: 5 additions & 1 deletion module/comment_like.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ module.exports = (query, request) => {
2: 'A_PL_0_', // 歌单
3: 'R_AL_3_', // 专辑
4: 'A_DJ_1_', // 电台,
5: 'R_VI_62_' // 视频
5: 'R_VI_62_',// 视频
6: 'A_EV_2_' // 动态
}[query.type]
const data = {
threadId: query.type + query.id,
commentId: query.cid
}
if(query.type == 'A_EV_2_'){
data.threadId = query.threadId
}
return request(
'POST', `https://music.163.com/weapi/v1/comment/${query.t}`, data,
{crypto: 'weapi', cookie: query.cookie, proxy: query.proxy}
Expand Down
12 changes: 12 additions & 0 deletions module/event_comments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = (query, request) => {
const data = {
limit: query.limit || 20,
offset: query.offset || 0
};
return request(
"POST",
`https://music.163.com/weapi/v1/resource/comments/${query.threadId}`,
data,
{ crypto: "weapi", cookie: query.cookie, proxy: query.proxy }
);
};
7 changes: 6 additions & 1 deletion module/resource_like.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// 点赞与取消点赞资源

module.exports = (query, request) => {
query.cookie.os = 'pc'
query.t = (query.t == 1 ? 'like' : 'unlike')
query.type = {
1: 'R_MV_5_', // MV
4: 'A_DJ_1_', // 电台
5: 'R_VI_62_' // 视频
5: 'R_VI_62_', // 视频
6: 'A_EV_2_'
}[query.type]
const data = {
threadId: query.type + query.id
}
if(query.type=='A_EV_2_'){
data.threadId=query.threadId
}
return request(
'POST', `https://music.163.com/weapi/resource/${query.t}`, data,
{crypto: 'weapi', cookie: query.cookie, proxy: query.proxy}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NeteaseCloudMusicApi",
"version": "3.4.0",
"version": "3.5.0",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
Expand Down

0 comments on commit 812640e

Please sign in to comment.