diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 0b2112f0024..c0361edebcf 100644 --- a/CHANGELOG.MD +++ b/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 - 修复依赖问题 diff --git a/docs/README.md b/docs/README.md index 0757461bc6e..e96492e8ab6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -181,6 +181,8 @@ 163. 数字专辑详情 164. 更新头像 165. 歌单封面上传 +166. 歌曲楼层评论 +167. 歌手全部歌曲 ## 安装 @@ -908,7 +910,7 @@ tags: 歌单标签 ### 歌手热门50首歌曲 -说明 : 调用此接口,可获取 +说明 : 调用此接口,可获取歌手热门50首歌曲 **必选参数 :** @@ -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` + ### 收藏的歌手列表 说明 : 调用此接口,可获取收藏的歌手列表 @@ -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 参数 , 可获得该专辑的所有评论 ( 不需要 diff --git a/module/artist_songs.js b/module/artist_songs.js new file mode 100644 index 00000000000..533e1e5e1a0 --- /dev/null +++ b/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, + }) +} diff --git a/module/comment_floor.js b/module/comment_floor.js new file mode 100644 index 00000000000..5a7bb551c04 --- /dev/null +++ b/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, + } + ) +} diff --git a/module/playlist_tracks.js b/module/playlist_tracks.js index 17ccb86dd07..fb1cb77a148 100644 --- a/module/playlist_tracks.js +++ b/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, + } + ) } - ) + } } diff --git a/package.json b/package.json index b24e66e8b06..4c4e88abf57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "3.37.2", + "version": "3.38.0", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js",