提交 ed0bca03 编写于 作者: B binaryify

新增点赞接口

上级 176d08b4
# 更新日志
### 2.5.4 | 2017.5.5
新增点赞接口,更新文档
### 2.5.3 | 2017.5.2
修复歌手单曲数据空白问题和文档获取歌手单曲url 描述问题,更新文档
......
......@@ -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 接口,增加刷新登录接口,增加电台相关接口,补充评论接口,更新文档
......
......@@ -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'))
......
......@@ -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
......
{
"name": "NeteaseCloudMusicApi",
"version": "2.5.3",
"version": "2.5.4",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.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')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册