From ea86e5bbeb5a81c4416459afdb1beeb412c254a5 Mon Sep 17 00:00:00 2001 From: binaryify Date: Sat, 29 May 2021 16:12:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=B2=E8=B4=AD=E5=8D=95?= =?UTF-8?q?=E6=9B=B2,=E8=8E=B7=E5=8F=96mlog=E6=92=AD=E6=94=BE=E5=9C=B0?= =?UTF-8?q?=E5=9D=80,=E5=B0=86mlog=20id=E8=BD=AC=E4=B8=BA=E8=A7=86?= =?UTF-8?q?=E9=A2=91id,vip=E6=88=90=E9=95=BF=E5=80=BC,vip=E6=88=90?= =?UTF-8?q?=E9=95=BF=E5=80=BC=E8=8E=B7=E5=8F=96=E8=AE=B0=E5=BD=95,vip?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1,=E9=A2=86=E5=8F=96vip=E6=88=90=E9=95=BF?= =?UTF-8?q?=E5=80=BC=20=E7=AD=89=E6=8E=A5=E5=8F=A3=20#1248?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 3 +++ app.js | 5 +++-- interface.d.ts | 13 ++++------- module/mlog_to_video.js | 29 ++++++++++++------------- module/mlog_url.js | 28 ++++++++++-------------- module/related_playlist.js | 3 +-- module/song_purchased.js | 31 +++++++++++++------------- module/vip_growthpoint.js | 27 +++++++++++------------ module/vip_growthpoint_details.js | 31 +++++++++++++------------- module/vip_growthpoint_get.js | 29 ++++++++++++------------- module/vip_tasks.js | 27 +++++++++++------------ module/yunbei_rcmd_song.js | 35 +++++++++++++++--------------- module/yunbei_rcmd_song_history.js | 35 +++++++++++++++--------------- package.json | 2 +- 14 files changed, 141 insertions(+), 157 deletions(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 9e7af87..daefab0 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,7 @@ # 更新日志 +### 4.0.15 | 2021.5.29 +- 新增已购单曲,获取mlog播放地址,将mlog id转为视频id,vip成长值,vip成长值获取记录,vip任务,领取vip成长值 等接口 [#1248](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1248) + ### 4.0.14 | 2021.5.28 - 增加云贝推歌接口,云贝推歌历史记录接口 [#1246](https://github.com/Binaryify/NeteaseCloudMusicApi/pull/1246) diff --git a/app.js b/app.js index fb56df2..f7f5020 100644 --- a/app.js +++ b/app.js @@ -42,8 +42,9 @@ app.use((req, res, next) => { ;(req.headers.cookie || '').split(/\s*;\s*/).forEach((pair) => { let crack = pair.indexOf('=') if (crack < 1 || crack == pair.length - 1) return - req.cookies[decodeURIComponent(pair.slice(0, crack)).trim()] = - decodeURIComponent(pair.slice(crack + 1)).trim() + req.cookies[ + decodeURIComponent(pair.slice(0, crack)).trim() + ] = decodeURIComponent(pair.slice(crack + 1)).trim() }) next() }) diff --git a/interface.d.ts b/interface.d.ts index 1306272..74907c5 100644 --- a/interface.d.ts +++ b/interface.d.ts @@ -1429,7 +1429,6 @@ export function cloud_match( } & RequestBaseConfig, ): Promise - export function yunbei_rcmd_song( params: { id: number | string @@ -1461,20 +1460,16 @@ export function mlog_to_video( } & RequestBaseConfig, ): Promise -export function vip_growthpoint( - params: RequestBaseConfig, -): Promise +export function vip_growthpoint(params: RequestBaseConfig): Promise export function vip_growthpoint_details( params: MultiPageConfig & RequestBaseConfig, ): Promise -export function vip_tasks( - params: RequestBaseConfig, -): Promise +export function vip_tasks(params: RequestBaseConfig): Promise export function vip_growthpoint_get( - params: { + params: { id?: number | string } & RequestBaseConfig, -): Promise \ No newline at end of file +): Promise diff --git a/module/mlog_to_video.js b/module/mlog_to_video.js index b1e791a..54b279e 100644 --- a/module/mlog_to_video.js +++ b/module/mlog_to_video.js @@ -1,19 +1,18 @@ // 将mlog id转为video id module.exports = (query, request) => { - const data = { - mlogId: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/mlog/video/convert/id`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + mlogId: query.id, } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/mlog/video/convert/id`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/mlog_url.js b/module/mlog_url.js index 015fcb8..f7223e0 100644 --- a/module/mlog_url.js +++ b/module/mlog_url.js @@ -1,21 +1,15 @@ // mlog链接 module.exports = (query, request) => { - const data = { - id: query.id, - resolution: query.res || 1080, - type: 1, - } - return request( - 'POST', - `https://music.163.com/weapi/mlog/detail/v1`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + id: query.id, + resolution: query.res || 1080, + type: 1, } - \ No newline at end of file + return request('POST', `https://music.163.com/weapi/mlog/detail/v1`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/module/related_playlist.js b/module/related_playlist.js index 02e580f..6f64b3d 100644 --- a/module/related_playlist.js +++ b/module/related_playlist.js @@ -13,8 +13,7 @@ module.exports = (query, request) => { }, ).then((response) => { try { - const pattern = - /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g + const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g let result, playlists = [] while ((result = pattern.exec(response.body)) != null) { diff --git a/module/song_purchased.js b/module/song_purchased.js index 757bf54..c86dfa1 100644 --- a/module/song_purchased.js +++ b/module/song_purchased.js @@ -1,20 +1,19 @@ // 已购单曲 module.exports = (query, request) => { - const data = { - limit: query.limit || 20, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/single/mybought/song/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + limit: query.limit || 20, + offset: query.offset || 0, } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/single/mybought/song/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/vip_growthpoint.js b/module/vip_growthpoint.js index e8f2eb9..e035c5a 100644 --- a/module/vip_growthpoint.js +++ b/module/vip_growthpoint.js @@ -1,17 +1,16 @@ // 会员成长值 module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - } - \ No newline at end of file + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/vip_growthpoint_details.js b/module/vip_growthpoint_details.js index eaa9874..be9c927 100644 --- a/module/vip_growthpoint_details.js +++ b/module/vip_growthpoint_details.js @@ -1,20 +1,19 @@ // 会员成长值领取记录 module.exports = (query, request) => { - const data = { - limit: query.limit || 20, - offset: query.offset || 0, - } - return request( - 'POST', - `https://music.163.com/weapi/vipnewcenter/app/level/growth/details`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + limit: query.limit || 20, + offset: query.offset || 0, } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growth/details`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/vip_growthpoint_get.js b/module/vip_growthpoint_get.js index 6a0563c..b903197 100644 --- a/module/vip_growthpoint_get.js +++ b/module/vip_growthpoint_get.js @@ -1,19 +1,18 @@ // 领取会员成长值 module.exports = (query, request) => { - const data = { - taskIds: query.id, - } - return request( - 'POST', - `https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + taskIds: query.id, } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/vip_tasks.js b/module/vip_tasks.js index cd599e5..256e67a 100644 --- a/module/vip_tasks.js +++ b/module/vip_tasks.js @@ -1,17 +1,16 @@ // 会员任务 module.exports = (query, request) => { - const data = {} - return request( - 'POST', - `https://music.163.com/weapi/vipnewcenter/app/level/task/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) - } - \ No newline at end of file + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/yunbei_rcmd_song.js b/module/yunbei_rcmd_song.js index 28d14e9..94ddeaa 100644 --- a/module/yunbei_rcmd_song.js +++ b/module/yunbei_rcmd_song.js @@ -1,22 +1,21 @@ // 云贝推歌 module.exports = (query, request) => { - const data = { - songId: query.id, - reason: query.reason || '好歌献给你', - scene: '', - fromUserId: -1, - } - return request( - 'POST', - `https://music.163.com/weapi/yunbei/rcmd/song/submit`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + songId: query.id, + reason: query.reason || '好歌献给你', + scene: '', + fromUserId: -1, } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/submit`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/module/yunbei_rcmd_song_history.js b/module/yunbei_rcmd_song_history.js index f0aacc4..224a4f8 100644 --- a/module/yunbei_rcmd_song_history.js +++ b/module/yunbei_rcmd_song_history.js @@ -1,22 +1,21 @@ // 云贝推歌历史记录 module.exports = (query, request) => { - const data = { - page: JSON.stringify({ - size: query.size || 20, - cursor: query.cursor || '', - }) - } - return request( - 'POST', - `https://music.163.com/weapi/yunbei/rcmd/song/history/list`, - data, - { - crypto: 'weapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - }, - ) + const data = { + page: JSON.stringify({ + size: query.size || 20, + cursor: query.cursor || '', + }), } - \ No newline at end of file + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/history/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/package.json b/package.json index 6f61ec4..349e00e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "4.0.14", + "version": "4.0.15", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", -- GitLab