From 40185476f2e683c68c37eacd9f8776463b790e9f Mon Sep 17 00:00:00 2001 From: binaryify Date: Sat, 14 Nov 2020 21:23:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8post?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=8F=96=E6=B6=88=E5=96=9C=E6=AC=A2=E9=9F=B3?= =?UTF-8?q?=E4=B9=90=E4=BC=9A=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20#1024,=20=E6=96=B0=E5=A2=9E=E6=8A=B1=E4=B8=80=E6=8A=B1?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=92=8C=E8=AF=84=E8=AE=BA=E6=8A=B1=E4=B8=80?= =?UTF-8?q?=E6=8A=B1=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=20#1016,=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=B6=E8=97=8F=E7=9A=84=E4=B8=93=E6=A0=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20#1026?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 7 +++++ README.MD | 3 ++ docs/README.md | 60 ++++++++++++++++++++++++++++++++++++++ interface.d.ts | 26 +++++++++++++++++ module/comment.js | 11 ++----- module/comment_floor.js | 10 ++----- module/comment_hot.js | 10 ++----- module/comment_hug_list.js | 21 +++++-------- module/comment_like.js | 11 ++----- module/comment_new.js | 13 ++------- module/hug_comment.js | 13 ++------- module/topic_sub_list.js | 15 ++++++++++ package.json | 2 +- util/config.json | 11 ++++++- 14 files changed, 143 insertions(+), 70 deletions(-) create mode 100644 module/topic_sub_list.js diff --git a/CHANGELOG.MD b/CHANGELOG.MD index e729bc20c86..1322f1f1ad4 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,11 @@ # 更新日志 +### 3.47.0 | 2020.11.14 +- 修复使用post请求取消喜欢音乐会失败的问题 [#1024](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1024) + +- 新增抱一抱评论和评论抱一抱列表接口 [#1016](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1016) + +- 新增收藏的专栏接口[#1026](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1026) + ### 3.46.1 | 2020.11.7 - 修复私信音乐接口出现风险提示的问题 diff --git a/README.MD b/README.MD index f961f6b07ff..b871f52e0f1 100644 --- a/README.MD +++ b/README.MD @@ -291,6 +291,9 @@ banner({ type:0 }).then(res=>{ 189. 账号信息 190. 最近联系人 191. 私信音乐 +192. 抱一抱评论 +193. 评论抱一抱列表 +194. 收藏的专栏 ## 更新日志 diff --git a/docs/README.md b/docs/README.md index cb5206cc1aa..4f15cf52fbf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -207,6 +207,9 @@ 189. 账号信息 190. 最近联系人 191. 私信音乐 +192. 抱一抱评论 +193. 评论抱一抱列表 +194. 收藏的专栏 ## 安装 @@ -1037,6 +1040,20 @@ tags: 歌单标签 **调用例子 :** `/artist/sublist` +### 收藏的专栏 + +说明 : 调用此接口,可获取收藏的专栏 + +**可选参数 :** + +`limit`: 取出歌单数量 , 默认为 50 + +`offset`: 偏移数量 , 用于分页 , 如 :( 评论页数 -1)\*50, 其中 50 为 limit 的值 + +**接口地址 :** `/topic/sublist` + +**调用例子 :** `/topic/sublist?limit=2&offset=1` + ### 收藏视频 说明 : 调用此接口,可收藏视频 @@ -1649,6 +1666,49 @@ mp3url 不能直接用 , 可通过 `/song/url` 接口传入歌曲 id 获取具 注意: 动态点赞不需要传入 id 参数,需要传入动态的 `threadId` 参数,如:`/comment/like?type=6&cid=1419532712&threadId=A_EV_2_6559519868_32953014&t=0`, `threadId` 可通过 `/event`,`/user/event` 接口获取 +### 抱一抱评论 + +说明 : 调用此接口,可抱一抱评论 + +**必选参数 :** + +`uid`: 用户id + +`cid`: 评论id + +`sid`: 资源id + +**接口地址 :** `/hug/comment` + +**调用例子 :** `/hug/comment?uid=285516405&cid=1167145843&sid=863481066` + +### 评论抱一抱列表 + +说明 : 调用此接口,可获取评论抱一抱列表 + +**必选参数 :** + +`uid`: 用户id + +`cid`: 评论id + +`sid`: 资源id + +**可选参数 :** + +`page`: 页数 + +`cursor`: 上一页返回的cursor,默认-1,第一页不需要传 + +`idCursor`: 上一页返回的idCursor,默认-1,第一页不需要传 + +`pageSize` : 每页页数,默认100 + +**接口地址 :** `/comment/hug/list` + +**调用例子 :** `/comment/hug/list?uid=285516405&cid=1167145843&sid=863481066&pageSize=2&page=1` + + ### 发送/删除评论 说明 : 调用此接口,可发送评论或者删除评论 diff --git a/interface.d.ts b/interface.d.ts index 84be90e36dc..d35d3389907 100644 --- a/interface.d.ts +++ b/interface.d.ts @@ -1307,3 +1307,29 @@ export function yunbei_task_finish( depositCode?: number | string } & RequestBaseConfig, ): Promise + +export function msg_recentcontact(params: RequestBaseConfig): Promise + +export function hug_comment( + params: { + uid: number | string + cid: number | string + sid: number | string + } & RequestBaseConfig, +): Promise + +export function comment_hug_list( + params: { + page: number | string + cursor: number | string + idCursor: number | string + pageSize?: number | string + } & RequestBaseConfig, +): Promise + +export function topic_sublist( + params: { + limit?: number | string + offset?: number | string + } & RequestBaseConfig, +): Promise diff --git a/module/comment.js b/module/comment.js index e7fd935eaf7..9395bf382d0 100644 --- a/module/comment.js +++ b/module/comment.js @@ -1,3 +1,4 @@ +const { resourceTypeMap } = require('../util/config.json') // 发送与删除评论 module.exports = (query, request) => { @@ -7,15 +8,7 @@ module.exports = (query, request) => { 0: 'delete', 2: 'reply', }[query.t] - 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_', // 视频 - 6: 'A_EV_2_', // 动态 - }[query.type] + query.type = resourceTypeMap[query.type] const data = { threadId: query.type + query.id, } diff --git a/module/comment_floor.js b/module/comment_floor.js index 53076455a74..de284708690 100644 --- a/module/comment_floor.js +++ b/module/comment_floor.js @@ -1,12 +1,6 @@ +const { resourceTypeMap } = require('../util/config.json') 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] + query.type = resourceTypeMap[query.type] const data = { parentCommentId: query.parentCommentId, threadId: query.type + query.id, diff --git a/module/comment_hot.js b/module/comment_hot.js index b975f3e925c..48586786dc9 100644 --- a/module/comment_hot.js +++ b/module/comment_hot.js @@ -1,15 +1,9 @@ +const { resourceTypeMap } = require('../util/config.json') // 热门评论 module.exports = (query, request) => { query.cookie.os = 'pc' - 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] + query.type = resourceTypeMap[query.type] const data = { rid: query.id, limit: query.limit || 20, diff --git a/module/comment_hug_list.js b/module/comment_hug_list.js index b0360f7bbcc..a8ef9596866 100644 --- a/module/comment_hug_list.js +++ b/module/comment_hug_list.js @@ -1,24 +1,17 @@ +const { resourceTypeMap } = require('../util/config.json') module.exports = (query, request) => { query.cookie.os = 'ios' query.cookie.appver = '7.3.27' - 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_', // 视频 - 6: 'A_EV_2_', // 动态 - }[query.type] - const threadId = query.type + query.id + query.type = resourceTypeMap[query.type || 0] + const threadId = query.type + query.sid const data = { targetUserId: query.uid, commentId: query.cid, - cursor: '-1', + cursor: query.cursor || '-1', threadId: threadId, - pageNo: 1, - idCursor: -1, - pageSize: 100, + pageNo: query.page || 1, + idCursor: query.idCursor || -1, + pageSize: query.pageSize || 100, } return request( 'POST', diff --git a/module/comment_like.js b/module/comment_like.js index 2e46287da4e..fa382a8f1e6 100644 --- a/module/comment_like.js +++ b/module/comment_like.js @@ -1,17 +1,10 @@ +const { resourceTypeMap } = require('../util/config.json') // 点赞与取消点赞评论 module.exports = (query, request) => { query.cookie.os = 'pc' query.t = query.t == 1 ? 'like' : 'unlike' - 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_', // 视频 - 6: 'A_EV_2_', // 动态 - }[query.type] + query.type = resourceTypeMap[query.type] const data = { threadId: query.type + query.id, commentId: query.cid, diff --git a/module/comment_new.js b/module/comment_new.js index 8399b122ecb..ad3cb0b59cd 100644 --- a/module/comment_new.js +++ b/module/comment_new.js @@ -1,21 +1,14 @@ +const { resourceTypeMap } = require('../util/config.json') // 评论 module.exports = (query, request) => { query.cookie.os = 'pc' - 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_', // 视频 - 6: 'A_EV_2_', // 动态 - }[query.type] + query.type = resourceTypeMap[query.type] const threadId = query.type + query.id const pageSize = query.pageSize || 20 const pageNo = query.pageNo || 1 const data = { - threadId: threadId, //'R_SO_4_863481066', + threadId: threadId, pageNo, showInner: query.showInner || true, pageSize, diff --git a/module/hug_comment.js b/module/hug_comment.js index 0b2590a59e9..481b9a45675 100644 --- a/module/hug_comment.js +++ b/module/hug_comment.js @@ -1,16 +1,9 @@ +const { resourceTypeMap } = require('../util/config.json') module.exports = (query, request) => { query.cookie.os = 'ios' query.cookie.appver = '7.3.27' - 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_', // 视频 - 6: 'A_EV_2_', // 动态 - }[query.type] - const threadId = query.type + query.id + query.type = resourceTypeMap[query.type || 0] + const threadId = query.type + query.sid const data = { targetUserId: query.uid, commentId: query.cid, diff --git a/module/topic_sub_list.js b/module/topic_sub_list.js new file mode 100644 index 00000000000..153b2985944 --- /dev/null +++ b/module/topic_sub_list.js @@ -0,0 +1,15 @@ +// 收藏的专栏 + +module.exports = (query, request) => { + const data = { + limit: query.limit || 50, + offset: query.offset || 0, + total: true, + } + return request('POST', `https://music.163.com/api/topic/sublist`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/package.json b/package.json index 188b6249afb..1e9da7dae10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "3.46.1", + "version": "3.47.0", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/util/config.json b/util/config.json index 96d5b80ab04..dbfda36742d 100644 --- a/util/config.json +++ b/util/config.json @@ -1,3 +1,12 @@ { - "anonymous_token": "8aae43f148f990410b9a2af38324af24e87ab9227c9265627ddd10145db744295fcd8701dc45b1ab8985e142f491516295dd965bae848761274a577a62b0fdc54a50284d1e434dcc04ca6d1a52333c9a" + "anonymous_token": "8aae43f148f990410b9a2af38324af24e87ab9227c9265627ddd10145db744295fcd8701dc45b1ab8985e142f491516295dd965bae848761274a577a62b0fdc54a50284d1e434dcc04ca6d1a52333c9a", + "resourceTypeMap": { + "0": "R_SO_4_", + "1": "R_MV_5_", + "2": "A_PL_0_", + "3": "R_AL_3_", + "4": "A_DJ_1_", + "5": "R_VI_62_", + "6": "A_EV_2_" + } }