增加发送/删除评论接口 #307

This commit is contained in:
binaryify 2018-08-29 21:57:30 +08:00
parent 2ae9aa5f22
commit 33ba035216
6 changed files with 171 additions and 57 deletions

View File

@ -1,49 +1,65 @@
# 更新日志 # 更新日志
### 2.18.0 | 2018.08.29
新增获取视频数据接口,完善文档 #301,感谢 @izhenyuls ### 2.19.0 | 2018.08.29
新增获取视频数据接口,新增发送/删除评论接口,修复登录状态接口问题,完善文档 #301,感谢 @izhenyuls
### 2.17.0 | 2018.08.28 ### 2.17.0 | 2018.08.28
新增登录状态查询接口 #302 ,完善文档,完善路由注册 #297 新增登录状态查询接口 #302 ,完善文档,完善路由注册 #297
### 2.16.0 | 2018.08.09 ### 2.16.0 | 2018.08.09
- Fixed #288,#289,#290 - Fixed #288,#289,#290
解决歌曲 URL 请求被判 Cheating,修复私信接收异常 #291 解决歌曲 URL 请求被判 Cheating,修复私信接收异常 #291
### 2.15.0 | 2018.07.30 ### 2.15.0 | 2018.07.30
新增相关歌单推荐和付费精选接口,增加歌手列表接口按首字母索引查找参数 新增相关歌单推荐和付费精选接口,增加歌手列表接口按首字母索引查找参数
### 2.14.0 | 2018.07.03 ### 2.14.0 | 2018.07.03
修复无法使用邮箱问题 修复无法使用邮箱问题
### 2.13.0 | 2018.06.05 ### 2.13.0 | 2018.06.05
增加自动注册路由的功能,简化路由注册逻辑 增加自动注册路由的功能,简化路由注册逻辑
### 2.12.0 | 2018.05.27 ### 2.12.0 | 2018.05.27
更新文档,优化歌单详情接口 更新文档,优化歌单详情接口
### 2.11.1 | 2018.05.24 ### 2.11.1 | 2018.05.24
更新文档,优化`/dj/program`接口 更新文档,优化`/dj/program`接口
### 2.11.0 | 2018.05.21 ### 2.11.0 | 2018.05.21
增加收藏歌手列表&订阅电台列表 增加收藏歌手列表&订阅电台列表
### 2.10.0 | 2018.05.17 ### 2.10.0 | 2018.05.17
歌单操作调整为批量操作 歌单操作调整为批量操作
### 2.9.9 | 2018.05.16 ### 2.9.9 | 2018.05.16
Bug 修复 Bug 修复
### 2.9.8 | 2018.05.10 ### 2.9.8 | 2018.05.10
新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口
### 2.9.6 | 2018.05.08 ### 2.9.6 | 2018.05.08
新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口
### 2.9.4 | 2018.05.04 ### 2.9.4 | 2018.05.04
新增热搜接口,更新 banner 接口 新增热搜接口,更新 banner 接口
### 2.9.2 | 2018.02.28 ### 2.9.2 | 2018.02.28
修复登录失败会崩溃的问题 修复登录失败会崩溃的问题
### 2.9.1 | 2018.01.26 ### 2.9.1 | 2018.01.26

View File

@ -95,6 +95,7 @@
73. 音乐是否可用检查接口 73. 音乐是否可用检查接口
74. 登录状态 74. 登录状态
75. 获取视频数据 75. 获取视频数据
76. 发送/删除评论
## 环境要求 ## 环境要求
@ -125,7 +126,6 @@ windows 下使用 git-bash 或者 cmder 等终端执行以下命令:
$ set PORT=4000 && node app.js $ set PORT=4000 && node app.js
``` ```
## 使用文档 ## 使用文档
[文档地址](https://binaryify.github.io/NeteaseCloudMusicApi) [文档地址](https://binaryify.github.io/NeteaseCloudMusicApi)
@ -145,16 +145,12 @@ $ npm test
![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot1.png) ![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot1.png)
![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot2.png) ![单元测试](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/screenshot2.png)
## 贡献者 ## 贡献者
[<img alt="nujhong" src="https://avatars1.githubusercontent.com/u/23186058?v=4&s=117" width="117">](https://github.com/nujhong)[<img alt="zhangzhengyi12" src="https://avatars1.githubusercontent.com/u/23502338?v=4&s=117" width="117">](https://github.com/zhangzhengyi12)[<img alt="mchome" src="https://avatars1.githubusercontent.com/u/7392658?v=4&s=117" width="117">](https://github.com/mchome)[<img alt="pengx17" src="https://avatars1.githubusercontent.com/u/584378?v=4&s=117" width="117">](https://github.com/pengx17)[<img alt="LengYXin" src="https://avatars1.githubusercontent.com/u/19631404?v=4&s=117" width="117">](https://github.com/LengYXin)[<img alt="rccoder" src="https://avatars3.githubusercontent.com/u/7554325?v=4&s=117" width="117">](https://github.com/rccoder) [<img alt="nujhong" src="https://avatars1.githubusercontent.com/u/23186058?v=4&s=117" width="117">](https://github.com/nujhong)[<img alt="zhangzhengyi12" src="https://avatars1.githubusercontent.com/u/23502338?v=4&s=117" width="117">](https://github.com/zhangzhengyi12)[<img alt="mchome" src="https://avatars1.githubusercontent.com/u/7392658?v=4&s=117" width="117">](https://github.com/mchome)[<img alt="pengx17" src="https://avatars1.githubusercontent.com/u/584378?v=4&s=117" width="117">](https://github.com/pengx17)[<img alt="LengYXin" src="https://avatars1.githubusercontent.com/u/19631404?v=4&s=117" width="117">](https://github.com/LengYXin)[<img alt="rccoder" src="https://avatars3.githubusercontent.com/u/7554325?v=4&s=117" width="117">](https://github.com/rccoder)
[<img alt="zhixuanziben" src="https://avatars0.githubusercontent.com/u/18346513?v=4&s=117" width="117">](https://github.com/zhixuanziben)[<img alt="LightStrawberry" src="https://avatars3.githubusercontent.com/u/5920513?v=4&s=117" width="117">](https://github.com/LightStrawberry)[<img alt="CeBkCn" src="https://avatars3.githubusercontent.com/u/14861605?v=4&s=117" width="117">](https://github.com/CeBkCn)[<img alt="nondanee" src="https://avatars0.githubusercontent.com/u/26399680?v=4&s=117" width="117">](https://github.com/nondanee)[<img alt="twesix" src="https://avatars1.githubusercontent.com/u/16174733?v=4&s=117" width="117">](https://github.com/twesix)[<img alt="Means88" src="https://avatars1.githubusercontent.com/u/5810331?s=460&v=47" width="117">](https://github.com/Means88) [<img alt="zhixuanziben" src="https://avatars0.githubusercontent.com/u/18346513?v=4&s=117" width="117">](https://github.com/zhixuanziben)[<img alt="LightStrawberry" src="https://avatars3.githubusercontent.com/u/5920513?v=4&s=117" width="117">](https://github.com/LightStrawberry)[<img alt="CeBkCn" src="https://avatars3.githubusercontent.com/u/14861605?v=4&s=117" width="117">](https://github.com/CeBkCn)[<img alt="nondanee" src="https://avatars0.githubusercontent.com/u/26399680?v=4&s=117" width="117">](https://github.com/nondanee)[<img alt="twesix" src="https://avatars1.githubusercontent.com/u/16174733?v=4&s=117" width="117">](https://github.com/twesix)[<img alt="Means88" src="https://avatars1.githubusercontent.com/u/5810331?s=460&v=47" width="117">](https://github.com/Means88)
## License ## License
[The MIT License (MIT)](https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/LICENSE) [The MIT License (MIT)](https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/LICENSE)

View File

@ -15,31 +15,41 @@
跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API 跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API
## 版本新特性 ## 版本新特性
### 2.18.0 | 2018.08.29
新增获取视频数据接口 ### 2.19.0 | 2018.08.29
新增获取视频数据接口,新增评论发送/删除接口
### 2.17.0 | 2018.08.28 ### 2.17.0 | 2018.08.28
新增登录状态查询接口 新增登录状态查询接口
### 2.15.0 | 2018.07.30 ### 2.15.0 | 2018.07.30
新增相关歌单推荐和付费精选接口,增加歌手列表接口按首字母索引查找参数 新增相关歌单推荐和付费精选接口,增加歌手列表接口按首字母索引查找参数
### 2.14.0 | 2018.07.03 ### 2.14.0 | 2018.07.03
修复无法使用邮箱问题 修复无法使用邮箱问题
### 2.11.0 | 2018.05.21 ### 2.11.0 | 2018.05.21
增加收藏歌手列表&订阅电台列表 增加收藏歌手列表&订阅电台列表
### 2.10.0 | 2018.05.17 ### 2.10.0 | 2018.05.17
歌单操作调整为批量操作 歌单操作调整为批量操作
### 2.9.8 | 2018.05.10 ### 2.9.8 | 2018.05.10
新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口
### 2.9.6 | 2018.05.08 ### 2.9.6 | 2018.05.08
新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口
### 2.9.4 | 2018.05.04 ### 2.9.4 | 2018.05.04
新增热搜接口,更新 banner 接口 新增热搜接口,更新 banner 接口
### 2.9.0 | 2018.01.26 ### 2.9.0 | 2018.01.26
@ -140,6 +150,7 @@ banner 接口 , 增加刷新登录接口 , 增加电台相关接口 , 补充评
73. 音乐是否可用检查接口 73. 音乐是否可用检查接口
74. 登录状态 74. 登录状态
75. 获取视频数据 75. 获取视频数据
76. 发送/删除评论
## 安装 ## 安装
@ -214,6 +225,7 @@ $ git clone https://github.com/Binaryify/NeteaseCloudMusicApi && cd NeteaseCloud
$ sudo docker build . -t netease-music-api $ sudo docker build . -t netease-music-api
$ sudo docker run -d -p 3000:3000 netease-music-api $ sudo docker run -d -p 3000:3000 netease-music-api
``` ```
## 接口文档 ## 接口文档
### 调用前须知 ### 调用前须知
@ -254,7 +266,6 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
~~ 注意 : 此接口被网易和谐了 , 待修复 , 暂时使用手机登录 (2017.05.20)~~ ~~ 注意 : 此接口被网易和谐了 , 待修复 , 暂时使用手机登录 (2017.05.20)~~
> 更新 : 此接口已经可以正常使用(2018.07.03) > 更新 : 此接口已经可以正常使用(2018.07.03)
**必选参数 :** `email`: 163 网易邮箱 `password`: 密码 **必选参数 :** `email`: 163 网易邮箱 `password`: 密码
@ -277,11 +288,10 @@ Cookies
说明 : 调用此接口 , 可刷新登录状态 说明 : 调用此接口 , 可刷新登录状态
**调用例子 :** `/login/refresh` **调用例子 :** `/login/refresh`
### 登录状态 ### 登录状态
说明 : 调用此接口,可获取登录状态 说明 : 调用此接口,可获取登录状态
**接口地址 :** `/login/status` **接口地址 :** `/login/status`
@ -311,6 +321,7 @@ Cookies
说明 : 登陆后调用此接口 , 传入相关信息,可以更新用户信息 说明 : 登陆后调用此接口 , 传入相关信息,可以更新用户信息
**必选参数 :** **必选参数 :**
``` ```
gender: 性别 0:保密 1:男性 2:女性 gender: 性别 0:保密 1:男性 2:女性
birthday: 出生日期,时间戳 unix timestamp birthday: 出生日期,时间戳 unix timestamp
@ -341,12 +352,14 @@ signature用户签名
说明 : 登陆后调用此接口,可以更新用户歌单 说明 : 登陆后调用此接口,可以更新用户歌单
参数: 参数:
``` ```
id:歌单id id:歌单id
name:歌单名字 name:歌单名字
desc:歌单描述 desc:歌单描述
tags:歌单tag tags:歌单tag
``` ```
**接口地址 :** `/playlist/update` **接口地址 :** `/playlist/update`
**调用例子 :** `/playlist/update/?id=24381616&name=新歌单&desc=描述&tags=学习` **调用例子 :** `/playlist/update/?id=24381616&name=新歌单&desc=描述&tags=学习`
@ -361,7 +374,6 @@ tags:歌单tag
`msg` : 要发送的信息 `msg` : 要发送的信息
**接口地址 :** `/send/text` **接口地址 :** `/send/text`
**调用例子 :** `/send/text?user_ids=32953014&msg=test`,`/send/text?user_ids=32953014,475625142&msg=test` **调用例子 :** `/send/text?user_ids=32953014&msg=test`,`/send/text?user_ids=32953014,475625142&msg=test`
@ -378,7 +390,6 @@ tags:歌单tag
`msg` : 要发送的信息 `msg` : 要发送的信息
**接口地址 :** `/send/playlist` **接口地址 :** `/send/playlist`
**调用例子 :** `/send/playlist?msg=test&user_ids=475625142&playlist=705123491`,`/send/playlist?msg=test2&user_ids=475625142,32953014&playlist=705123493` **调用例子 :** `/send/playlist?msg=test&user_ids=475625142&playlist=705123491`,`/send/playlist?msg=test2&user_ids=475625142,32953014&playlist=705123493`
@ -458,6 +469,7 @@ tags:歌单tag
**调用例子 :** `/event` **调用例子 :** `/event`
### 歌手分类列表 ### 歌手分类列表
说明 : 调用此接口,可获取歌手分类列表 说明 : 调用此接口,可获取歌手分类列表
**必选参数 :** `cat` : 即 category Code,歌手类型,默认 1001,返回华语男歌手数据 **必选参数 :** `cat` : 即 category Code,歌手类型,默认 1001,返回华语男歌手数据
**可选参数 :** **可选参数 :**
@ -468,6 +480,7 @@ tags:歌单tag
`initial`: 按首字母索引查找参数,如 `/artist/list?cat=1001&initial=b` 返回内容将以 name 字段开头为 b 或者拼音开头为 b 为顺序排列 `initial`: 按首字母索引查找参数,如 `/artist/list?cat=1001&initial=b` 返回内容将以 name 字段开头为 b 或者拼音开头为 b 为顺序排列
category Code 取值: category Code 取值:
``` ```
入驻歌手 5001 入驻歌手 5001
华语男歌手 1001 华语男歌手 1001
@ -489,13 +502,13 @@ category Code 取值:
**接口地址 :** `/artist/list` **接口地址 :** `/artist/list`
**调用例子 :** `/artist/list?cat=1001` **调用例子 :** `/artist/list?cat=1001`
返回数据如下图: 返回数据如下图:
![数据](https://ws1.sinaimg.cn/large/006tKfTcgy1fr60g9zps9j31kw1bpk4n.jpg) ![数据](https://ws1.sinaimg.cn/large/006tKfTcgy1fr60g9zps9j31kw1bpk4n.jpg)
### 收藏歌手 ### 收藏歌手
说明 : 调用此接口,可收藏歌手 说明 : 调用此接口,可收藏歌手
**必选参数 :** `artistId` : 歌手 id **必选参数 :** `artistId` : 歌手 id
@ -504,36 +517,36 @@ category Code 取值:
**调用例子 :** `/artist/sub?id=6452` **调用例子 :** `/artist/sub?id=6452`
### 取消收藏歌手 ### 取消收藏歌手
说明 : 调用此接口,可取消收藏歌手 说明 : 调用此接口,可取消收藏歌手
**必选参数 :** `artistId` : 歌手 id **必选参数 :** `artistId` : 歌手 id
**接口地址 :** `/artist/unsub` **接口地址 :** `/artist/unsub`
**调用例子 :** `/artist/unsub?id=6452` **调用例子 :** `/artist/unsub?id=6452`
### 收藏的歌手列表 ### 收藏的歌手列表
说明 : 调用此接口,可获取收藏的歌手列表 说明 : 调用此接口,可获取收藏的歌手列表
**接口地址 :** `/artist/sublist` **接口地址 :** `/artist/sublist`
**调用例子 :** `/artist/sublist` **调用例子 :** `/artist/sublist`
### 歌单分类 ### 歌单分类
说明 : 调用此接口,可获取歌单分类,包含 category 信息 说明 : 调用此接口,可获取歌单分类,包含 category 信息
**接口地址 :** `/playlist/catlist` **接口地址 :** `/playlist/catlist`
**调用例子 :** `/playlist/catlist` **调用例子 :** `/playlist/catlist`
### 热门歌单分类 ### 热门歌单分类
说明 : 调用此接口,可获取歌单分类,包含 category 信息 说明 : 调用此接口,可获取歌单分类,包含 category 信息
**接口地址 :** `/playlist/hot` **接口地址 :** `/playlist/hot`
**调用例子 :** `/playlist/hot` **调用例子 :** `/playlist/hot`
### 歌单 ( 网友精选碟 ) ### 歌单 ( 网友精选碟 )
@ -606,6 +619,7 @@ category Code 取值:
![音乐 url](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E9%9F%B3%E4%B9%90%20url.png) ![音乐 url](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E9%9F%B3%E4%B9%90%20url.png)
### 音乐是否可用 ### 音乐是否可用
说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }` 说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }`
**必选参数 :** `id` : 歌曲 id **必选参数 :** `id` : 歌曲 id
@ -638,6 +652,7 @@ mp3url 不能直接用 , 可通过 `/music/url` 接口传入歌曲 id 获取具
![搜索音乐](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%90%9C%E7%B4%A2.png) ![搜索音乐](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%90%9C%E7%B4%A2.png)
### 热搜 ### 热搜
说明 : 调用此接口,可获取热门搜索列表 说明 : 调用此接口,可获取热门搜索列表
**接口地址 :** `/search/hot` **接口地址 :** `/search/hot`
@ -702,7 +717,6 @@ mp3url 不能直接用 , 可通过 `/music/url` 接口传入歌曲 id 获取具
返回数据如下图: 返回数据如下图:
![数据](https://ws1.sinaimg.cn/large/006tKfTcgy1fr3vdwx0hvj30s405u74b.jpg) ![数据](https://ws1.sinaimg.cn/large/006tKfTcgy1fr3vdwx0hvj30s405u74b.jpg)
### 对歌单添加或删除歌曲 ### 对歌单添加或删除歌曲
说明 : 调用此接口 , 可以添加歌曲到歌单或者从歌单删除某首歌曲 ( 需要登录 ) 说明 : 调用此接口 , 可以添加歌曲到歌单或者从歌单删除某首歌曲 ( 需要登录 )
@ -834,6 +848,51 @@ mp3url 不能直接用 , 可通过 `/music/url` 接口传入歌曲 id 获取具
**调用例子 :** `/comment/like?id=186016&cid=4956438&t=1&type=0` 对应给晴天最热门 **调用例子 :** `/comment/like?id=186016&cid=4956438&t=1&type=0` 对应给晴天最热门
的那条评论点赞 的那条评论点赞
### 发送/删除评论
说明 : 调用此接口,可发送评论或者删除评论
**接口地址 :** `/comment`
1. 发送评论
**必选参数**
`action`:1 发送
`tpye`: 数字 , 资源类型 , 对应歌曲 , mv, 专辑 , 歌单 , 电台对应以下类型
```
0: 歌曲
1: mv
2: 歌单
3: 专辑
4: 电台
```
`id`:对应资源 id
`content` :要发送的内容
**调用例子** : `/comment?action=1&type=1&id=5436712&content=test` (往广岛之恋 mv 发送评论: test)
2. 删除评论
**必选参数**
`action`:0 删除
`tpye`: 数字 , 资源类型 , 对应歌曲 , mv, 专辑 , 歌单 , 电台对应以下类型
```
0: 歌曲
1: mv
2: 歌单
3: 专辑
4: 电台
```
`id`:对应资源 id
`content` :内容 id,可通过 `/comment/mv` 等接口获取
**调用例子** : `/comment?action=0&type=1&id=5436712&commentId=1535550516319` (在广岛之恋 mv 删除评论)
### banner ### banner
说明 : 调用此接口 , 可获取 banner( 轮播图 ) 数据注 : 因参数未知 , 只能获取比较旧 说明 : 调用此接口 , 可获取 banner( 轮播图 ) 数据注 : 因参数未知 , 只能获取比较旧
@ -1312,7 +1371,6 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009`
说明 : 登陆后调用此接口 , 可获取订阅的电台列表 说明 : 登陆后调用此接口 , 可获取订阅的电台列表
**接口地址 :** `/dj/sublist` **接口地址 :** `/dj/sublist`
**调用例子 :** `/dj/sublist` **调用例子 :** `/dj/sublist`

View File

@ -1,6 +1,6 @@
{ {
"name": "NeteaseCloudMusicApi", "name": "NeteaseCloudMusicApi",
"version": "2.18.0", "version": "2.19.0",
"description": "网易云音乐 NodeJS 版 API", "description": "网易云音乐 NodeJS 版 API",
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",

45
router/comment.js Normal file
View File

@ -0,0 +1,45 @@
module.exports = (req, res, createWebAPIRequest, request) => {
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
const id = req.query.id
const action = req.query.action == 1 ? 'add' : 'delete'
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]
let data = {
threadId: `${type}${id}`,
csrf_token: ''
}
if (action == 'add') {
data = {
...data,
content: req.query.content
}
}
if (action == 'delete') {
data = {
...data,
commentId: req.query.commentId
}
}
const url = `/weapi/resource/comments/${action}`
// console.log({ url, data })
createWebAPIRequest(
'music.163.com',
url,
'POST',
data,
cookie,
music_req => res.send(music_req),
err => res.status(502).send('fetch error')
)
}

View File

@ -1,32 +1,31 @@
//comment like //comment like
//未知 api
module.exports = (req, res, createWebAPIRequest, request) => { module.exports = (req, res, createWebAPIRequest, request) => {
const cookie = req.get("Cookie") ? req.get("Cookie") : ""; const cookie = req.get('Cookie') ? req.get('Cookie') : ''
const cid = req.query.cid; //评论 id const cid = req.query.cid //评论 id
const id = req.query.id; // 歌曲 id const id = req.query.id // 歌曲 id
const typeMap = { const typeMap = {
0: "R_SO_4_", //歌曲 0: 'R_SO_4_', //歌曲
1: "R_MV_5_", //mv 1: 'R_MV_5_', //mv
2: "A_PL_0_", //歌单 2: 'A_PL_0_', //歌单
3: "R_AL_3_", //专辑 3: 'R_AL_3_', //专辑
4: "A_DJ_1_" //电台 4: 'A_DJ_1_' //电台
}; }
const type = typeMap[req.query.type]; const type = typeMap[req.query.type]
const data = { const data = {
threadId: `${type}${id}`, threadId: `${type}${id}`,
commentId: cid, commentId: cid,
csrf_token: "" csrf_token: ''
}; }
const action = req.query.t == 1 ? "like" : "unlike"; const action = req.query.t == 1 ? 'like' : 'unlike'
const url = `/weapi/v1/comment/${action}`; const url = `/weapi/v1/comment/${action}`
createWebAPIRequest( createWebAPIRequest(
"music.163.com", 'music.163.com',
url, url,
"POST", 'POST',
data, data,
cookie, cookie,
music_req => res.send(music_req), music_req => res.send(music_req),
err => res.status(502).send("fetch error") err => res.status(502).send('fetch error')
); )
}; }