From ed0bca03cd8ed60c0545501ee68eae22da28380b Mon Sep 17 00:00:00 2001 From: binaryify Date: Fri, 5 May 2017 15:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=82=B9=E8=B5=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 3 +++ README.MD | 3 +++ app.js | 2 +- docs/README.md | 30 ++++++++++++++++++++++++++++-- package.json | 2 +- router/comment_like.js | 15 ++++++++++++--- 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index b1c11e8..55e1613 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,7 @@ # 更新日志 +### 2.5.4 | 2017.5.5 +新增点赞接口,更新文档 + ### 2.5.3 | 2017.5.2 修复歌手单曲数据空白问题和文档获取歌手单曲url 描述问题,更新文档 diff --git a/README.MD b/README.MD index 62ca616..1b10cc1 100644 --- a/README.MD +++ b/README.MD @@ -14,6 +14,9 @@ [darknessomi/musicbox](https://github.com/darknessomi/musicbox) ## 版本新特性 +### 2.5.4 | 2017.5.5 +新增点赞接口,更新文档 + ### 2.5.0 | 2017.4.29 增加 mv/专辑/歌单评论接口,增加云盘相关接口,增加获取用户动态/信息接口,增加关注/粉丝列表接口,增加收藏歌单接口,增加相似 mv/歌曲/用户接口,增加 banner 接口,增加刷新登录接口,增加电台相关接口,补充评论接口,更新文档 diff --git a/app.js b/app.js index 90f20b0..18745f8 100644 --- a/app.js +++ b/app.js @@ -222,7 +222,7 @@ app.use("/user/cloud", require("./router/user_cloud")) app.use("/user/cloud/search", require("./router/user_cloud_search")) //用户动态 app.use("/user/event", require("./router/user_event")) -// 获取用户歌单 + app.use('/user/detail', require('./router/user_detail')) app.use('/user/dj', require('./router/user_dj')) diff --git a/docs/README.md b/docs/README.md index 752e091..6442fcd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -76,6 +76,7 @@ 57. 电台-订阅 58. 电台-详情 59. 电台-节目 +60. 给评论点赞 ## 安装 @@ -257,7 +258,7 @@ $ set PORT=4000 && node app.js **可选参数:** `limit`: 取出评论数量,默认为20 -`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值 +`offset`: 偏移数量,用于分页,如:(页数-1)*20, 其中 20 为 limit 的值 **接口地址:** `/top/playlist/highquality` @@ -400,7 +401,7 @@ $ set PORT=4000 && node app.js `/comment/music` **调用例子:** -`/comment/music?id=186016&limit=1` +`/comment/music?id=186016&limit=1` 对应晴天评论 返回数据如下图: ![获取评论](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/comment.png) @@ -474,6 +475,31 @@ $ set PORT=4000 && node app.js **调用例子:** `/comment/dj?id=794062371` +### 给评论点赞 +说明:调用此接口,传入 type, 资源 id, 和评论id cid和 是否点赞参数 t 即可给对应评论点赞(需要登录) + +**必选参数:** +`id` : 资源 id, 如歌曲 id,mv id +`cid` : 评论 id + +**可选参数:** +`tpye`: 数字,资源类型,对应歌曲, mv, 专辑,歌单,电台,默认为0 +对应以下类型 + +``` +0: 歌曲 +1: mv +2: 歌单 +3: 专辑 +4: 电台 +``` + +**接口地址:** +`comment/like` + +**调用例子:** +`/comment/like?id=186016&cid=4956438&t=1&type=0` 对应给晴天最热门的那条评论点赞 + ### banner 说明:调用此接口,可获取 banner(轮播图)数据 注:因参数未知,只能获取比较旧的数据,如果有知道参数的小伙伴,可提交 PR diff --git a/package.json b/package.json index a0882fd..9fa8b6d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "2.5.3", + "version": "2.5.4", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/router/comment_like.js b/router/comment_like.js index 530c7e9..17f76cd 100644 --- a/router/comment_like.js +++ b/router/comment_like.js @@ -5,10 +5,19 @@ const { createWebAPIRequest } = require("../util/util") router.get("/", (req, res) => { const cookie = req.get('Cookie') ? req.get('Cookie') : '' - const id = req.query.id + const cid = req.query.cid //评论 id + const id=req.query.id// 歌曲 id + const typeMap={ + 0:"R_SO_4_",//歌曲 + 1:"R_MV_5_",//mv + 2:"A_PL_0_",//歌单 + 3:"R_AL_3_",//专辑 + 4:"A_DJ_1_",//电台 + } + const type=typeMap[req.query.type] const data = { - "threadId": req.query.origin, - commentId:id, + "threadId": `${type}${id}`, + commentId:cid, "csrf_token": "" } const action=(req.query.t==1?'like':'unlike') -- GitLab