From 420b7d1bc14045f56942653a998dee99024aee35 Mon Sep 17 00:00:00 2001 From: binaryify Date: Tue, 8 May 2018 14:22:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8d67b2e..1d2f56d 100644 --- a/package.json +++ b/package.json @@ -14,17 +14,17 @@ "author": "", "license": "MIT", "dependencies": { - "apicache": "^1.2.0", - "big-integer": "^1.6.26", - "express": "^4.16.2", - "request": "^2.83.0" + "apicache": "^1.2.1", + "big-integer": "^1.6.28", + "express": "^4.16.3", + "request": "^2.85.0" }, "devDependencies": { "husky": "^0.14.3", "intelli-espower-loader": "^1.0.1", - "lint-staged": "^6.0.1", - "mocha": "^5.0.0", - "power-assert": "^1.4.4", - "prettier": "^1.10.2" + "lint-staged": "^7.1.0", + "mocha": "^5.1.1", + "power-assert": "^1.5.0", + "prettier": "^1.12.1" } } From 69162ac6c06506d769570bfee04299f640ee274d Mon Sep 17 00:00:00 2001 From: LightStrawberry Date: Thu, 10 May 2018 04:07:06 +0800 Subject: [PATCH 2/5] user_update and playlist_update --- app.js | 7 ++++--- router/playlist_update.js | 33 +++++++++++++++++++++++++++++++++ router/user_update.js | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 router/playlist_update.js create mode 100644 router/user_update.js diff --git a/app.js b/app.js index 62c22f7..6e75b3e 100644 --- a/app.js +++ b/app.js @@ -185,9 +185,6 @@ app.use("/search/multimatch", require("./router/search_multimatch")); // 搜索 suggest,搜索结果包含单曲,歌手,歌单,mv信息 app.use("/search/suggest", require("./router/search_suggest")); - - - //simi ,相似歌单 app.use("/simi/playlist", require("./router/simi_playlist")); @@ -259,6 +256,8 @@ app.use("/user/subcount", require("./router/user_subcount")); app.use("/user/record", require("./router/user_playrecord")); +app.use("/user/update", require("./router/user_update")); + app.use("/send/text", require("./router/send_text")); app.use("/send/playlist", require("./router/send_playlist")); @@ -267,6 +266,8 @@ app.use("/playlist/create", require("./router/playlist_create")); app.use("/playlist/subscribe", require("./router/playlist_subscribe")); +app.use("/playlist/update", require("./router/playlist_update")); + const port = process.env.PORT || 3000; app.listen(port, () => { diff --git a/router/playlist_update.js b/router/playlist_update.js new file mode 100644 index 0000000..ec88b96 --- /dev/null +++ b/router/playlist_update.js @@ -0,0 +1,33 @@ +const express = require("express"); +const router = express(); +const { createWebAPIRequest } = require("../util/util"); + +router.get("/", (req, res) => { + const cookie = req.get("Cookie") ? req.get("Cookie") : ""; + const playlist_id = req.query.id; + const desc_detail = req.query.desc || ""; + const tags_detail = req.query.tags || ""; + const name_detail = req.query.name; + const data = { + "/api/playlist/desc/update": + '{"id":' + playlist_id + ',"desc":"' + desc_detail + '"}', + "/api/playlist/tags/update": + '{"id":' + playlist_id + ',"tags":"' + tags_detail + '"}', + "/api/playlist/update/name": + '{"id":' + playlist_id + ',"name":"' + name_detail + '"}', + csrf_token: "" + }; + createWebAPIRequest( + "music.163.com", + "/weapi/batch", + "POST", + data, + cookie, + music_req => { + res.send(music_req); + }, + err => res.status(502).send("fetch error") + ); +}); + +module.exports = router; diff --git a/router/user_update.js b/router/user_update.js new file mode 100644 index 0000000..2ea5257 --- /dev/null +++ b/router/user_update.js @@ -0,0 +1,33 @@ +const express = require("express"); +const router = express(); +const { createWebAPIRequest } = require("../util/util"); + +router.get("/", (req, res) => { + const cookie = req.get("Cookie") ? req.get("Cookie") : ""; + // 暂时不提供更换头像接口 + // gender为0表示保密,1为男性,2为女性 + const gender_type = req.query.gender; + // birthday 为unix13位时间戳 + // province_number and city_number + const data = { + avatarImgId: "0", + birthday: req.query.birthday, + city: req.query.city, + gender: gender_type, + nickname: req.query.nickname, + province: req.query.province, + signature: req.query.signature, + csrf_token: "" + }; + createWebAPIRequest( + "music.163.com", + "/weapi/user/profile/update", + "POST", + data, + cookie, + music_req => res.send(music_req), + err => res.status(502).send("fetch error") + ); +}); + +module.exports = router; From 65d2a3f9188c0d596cee9163364d04bddcd9de37 Mon Sep 17 00:00:00 2001 From: binaryify Date: Thu, 10 May 2018 10:00:52 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=AD=8C=E6=89=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=88=97=E8=A1=A8,=E6=94=B6=E8=97=8F/?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F=E6=AD=8C=E6=89=8B=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 +++ docs/README.md | 60 ++++++++++++++++++++++++++++++++++++++++++- package.json | 2 +- router/artist_list.js | 2 +- 4 files changed, 64 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 0b05583..34b7a1d 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,7 @@ # 更新日志 +### 2.9.7 | 2018.05.10 +新增歌手分类列表,收藏/取消收藏歌手接口 + ### 2.9.6 | 2018.05.08 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 diff --git a/docs/README.md b/docs/README.md index 83cee7c..c60028e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,6 +15,8 @@ 跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API ## 版本新特性 +### 2.9.7 | 2018.05.10 +新增歌手分类列表,收藏/取消收藏歌手接口 ### 2.9.6 | 2018.05.08 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 @@ -392,6 +394,59 @@ Cookies **调用例子 :** `/event` +### 歌手分类列表 +说明 : 调用此接口,可获取歌手分类列表 +**必选参数 :** `cat` : 即 category Code,歌手类型,默认 1001,返回华语男歌手数据 +**可选参数 :** +`limit` : 返回数量 , 默认为 30 + +`offset` : 偏移数量,用于分页 , 如 +: 如 :( 页数 -1)\*30, 其中 30 为 limit 的值 , 默认为 0 +category Code 取值: +``` +入驻歌手 5001 +华语男歌手 1001 +华语女歌手 1002 +华语组合/乐队 1003 +欧美男歌手 2001 +欧美女歌手 2002 +欧美组合/乐队 2003 +日本男歌手 6001 +日本女歌手 6002 +日本组合/乐队 6003 +韩国男歌手 7001 +韩国女歌手 7002 +韩国组合/乐队 7003 +其他男歌手 4001 +其他女歌手 4002 +其他组合/乐队 4003 +``` + +**接口地址 :** `/artist/list` + + +**调用例子 :** `/artist/list?cat=1001` + +返回数据如下图: +![数据](https://ws1.sinaimg.cn/large/006tKfTcgy1fr60g9zps9j31kw1bpk4n.jpg) + +### 收藏歌手 +说明 : 调用此接口,可收藏歌手 +**必选参数 :** `artistId` : 歌手 id + +**接口地址 :** `/artist/sub` + +**调用例子 :** `/artist/sub?id=6452` + +### 取消收藏歌手 +说明 : 调用此接口,可取消收藏歌手 +**必选参数 :** `artistId` : 歌手 id + +**接口地址 :** `/artist/unsub` + + +**调用例子 :** `/artist/unsub?id=6452` + ### 歌单分类 说明 : 调用此接口,可获取歌单分类,包含 category 信息 @@ -510,7 +565,10 @@ mp3url 不能直接用 , 可通过 `/music/url` 接口传入歌曲 id 获取具 **必选参数 :** `keywords` : 关键词 -**可选参数 :** `limit` : 返回数量 , 默认为 30 `offset` : 偏移数量,用于分页 , 如 +**可选参数 :** +`limit` : 返回数量 , 默认为 30 + +`offset` : 偏移数量,用于分页 , 如 : 如 :( 页数 -1)\*30, 其中 30 为 limit 的值 , 默认为 0 `type`: 搜索类型;默认为 1 即单曲 , 取值意义 : 1: 单曲 10: 专辑 100: 歌手 1000: diff --git a/package.json b/package.json index 1d2f56d..be7162d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "2.9.6", + "version": "2.9.7", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/router/artist_list.js b/router/artist_list.js index 3f8ba03..b150dc7 100644 --- a/router/artist_list.js +++ b/router/artist_list.js @@ -29,7 +29,7 @@ router.get("/", (req, res) => { categoryCode: req.query.cat || "1001", offset: req.query.offset || 0, total: req.query.total ? "true" : "false", - limit: req.query.limit || 50 + limit: req.query.limit || 30 }; createWebAPIRequest( "music.163.com", From 1d42dbd2f2a4822a3823365f9ddad9633880fafb Mon Sep 17 00:00:00 2001 From: binaryify Date: Thu, 10 May 2018 10:17:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF,=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=AD=8C=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 4 ++-- docs/README.md | 36 ++++++++++++++++++++++++++++++++++-- package.json | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 34b7a1d..c623741 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,6 +1,6 @@ # 更新日志 -### 2.9.7 | 2018.05.10 -新增歌手分类列表,收藏/取消收藏歌手接口 +### 2.9.8 | 2018.05.10 +新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 ### 2.9.6 | 2018.05.08 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 diff --git a/docs/README.md b/docs/README.md index c60028e..0c0cb83 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,8 +15,8 @@ 跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API ## 版本新特性 -### 2.9.7 | 2018.05.10 -新增歌手分类列表,收藏/取消收藏歌手接口 +### 2.9.8 | 2018.05.10 +新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 ### 2.9.6 | 2018.05.08 新增发送私信相关接口,新增新建歌单,收藏/取消收藏歌单接口 @@ -278,6 +278,24 @@ Cookies **调用例子 :** `/user/subcount` +### 更新用户信息 + +说明 : 登陆后调用此接口 , 传入相关信息,可以更新用户信息 + +**必选参数 :** +``` +gender: 性别 0:保密 1:男性 2:女性 +birthday: 出生日期,时间戳 unix timestamp +nickname: 用户昵称 +province: 省份id +city: 城市id +signature:用户签名 +``` + +**接口地址 :** `/user/subcount` + +**调用例子 :** `/user/update/?gender=0&signature=测试签名&city=440300&nickname=binary&birthday=1525918298004&province=440000` + ### 获取用户歌单 说明 : 登陆后调用此接口 , 传入用户 id, 可以获取用户歌单 @@ -291,6 +309,20 @@ Cookies 返回数据如下图 : ![用户歌单](https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E7%94%A8%E6%88%B7%E6%AD%8C%E5%8D%95.png) +### 更新歌单 + +说明 : 登陆后调用此接口,可以更新用户歌单 +参数: +``` +id:歌单id +name:歌单名字 +desc:歌单描述 +tags:歌单tag +``` +**接口地址 :** `/playlist/update` + +**调用例子 :** `/playlist/update/?id=24381616&name=新歌单&desc=描述&tags=学习` + ### 发送私信 说明 : 登陆后调用此接口 , 传入用户 id 和要发送的信息, 可以发送私信,返回内容为历史私信,包含带歌单的私信信息(注:不能发送私信给自己) diff --git a/package.json b/package.json index be7162d..f42c652 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "2.9.7", + "version": "2.9.8", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", From 36726b5e9048f7d17d9801e3242bc930d868ae68 Mon Sep 17 00:00:00 2001 From: binaryify Date: Thu, 10 May 2018 10:22:23 +0800 Subject: [PATCH 5/5] update --- README.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.MD b/README.MD index 633c6b0..ea6ac51 100644 --- a/README.MD +++ b/README.MD @@ -19,6 +19,8 @@ [sqaiyan/netmusic-node](https://github.com/sqaiyan/netmusic-node) ## 版本新特性 +### 2.9.8 | 2018.05.10 +新增歌手分类列表,收藏/取消收藏歌手接口,新增更新用户信息,更新歌单接口 ### 2.9.0 | 2018.01.26