Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
新增歌曲楼层评论,歌手全部歌曲接口 #864, #867, 支持收藏VIP或付费歌曲到歌单 #860, 支持手动传入realIP #863
Browse files Browse the repository at this point in the history
  • Loading branch information
Binaryify committed Aug 9, 2020
1 parent 9063c7d commit 324cd8b
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
@@ -1,4 +1,9 @@
# 更新日志
### 3.38.0 | 2020.08.09
- 新增`歌曲楼层评论`,`歌手全部歌曲`接口 [#864](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/864) [#867](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/867)
- 支持收藏VIP或付费歌曲到歌单 [#860](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/860)
- 支持手动传入`realIP` [#863](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/863)

### 3.37.2 | 2020.08.04
- 修复依赖问题

Expand Down
58 changes: 57 additions & 1 deletion docs/README.md
Expand Up @@ -181,6 +181,8 @@
163. 数字专辑详情
164. 更新头像
165. 歌单封面上传
166. 歌曲楼层评论
167. 歌手全部歌曲

## 安装

Expand Down Expand Up @@ -908,7 +910,7 @@ tags: 歌单标签

### 歌手热门50首歌曲

说明 : 调用此接口,可获取
说明 : 调用此接口,可获取歌手热门50首歌曲

**必选参数 :**

Expand All @@ -918,6 +920,24 @@ tags: 歌单标签

**调用例子 :** `/artist/top/song?id=6452`

### 歌手全部歌曲
说明 : 调用此接口,可获取歌手全部歌曲
**必选参数 :**

`id` : 歌手 id

**可选参数 :**

`order` : `hot` ,`time` 按照热门或者时间排序

`limit`: 取出歌单数量 , 默认为 50

`offset`: 偏移数量 , 用于分页 , 如 :( 评论页数 -1)\*50, 其中 50 为 limit 的值

**接口地址 :** `/artist/songs`

**调用例子 :** `/artist/songs?id=6452`

### 收藏的歌手列表

说明 : 调用此接口,可获取收藏的歌手列表
Expand Down Expand Up @@ -1275,6 +1295,42 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具
返回数据如下图 :
![获取评论](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/comment.png)

### 歌曲楼层评论

说明 : 调用此接口 , 传入音乐 parentCommentId 和 threadId 参数 , 可获得该音乐的歌曲楼层评论

**必选参数 :**
`parentCommentId`: 楼层评论 id

`id` : 资源 id

`tpye`: 数字 , 资源类型 , 对应歌曲 , mv, 专辑 , 歌单 , 电台, 视频对应以下类型

```
0: 歌曲
1: mv
2: 歌单
3: 专辑
4: 电台
5: 视频
```


**可选参数 :** `limit`: 取出评论数量 , 默认为 20

`offset`: 偏移数量 , 用于分页 , 如 :( 评论页数 -1)\*20, 其中 20 为 limit 的值

`time`: 分页参数,取上一页最后一项的 `time` 获取下一页数据

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

**调用例子 :** `/comment/floor?parentCommentId=1438569889&id=29764564&type=0`

### 专辑评论

说明 : 调用此接口 , 传入音乐 id 和 limit 参数 , 可获得该专辑的所有评论 ( 不需要
Expand Down
17 changes: 17 additions & 0 deletions module/artist_songs.js
@@ -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 changes: 27 additions & 0 deletions module/comment_floor.js
@@ -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,
}
)
}
55 changes: 43 additions & 12 deletions module/playlist_tracks.js
@@ -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,
}
)
}
)
}
}
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "NeteaseCloudMusicApi",
"version": "3.37.2",
"version": "3.38.0",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
Expand Down

0 comments on commit 324cd8b

Please sign in to comment.