From 65e32eec770f7c8151d3c9b730c7425aad29cef8 Mon Sep 17 00:00:00 2001 From: binaryify Date: Sun, 1 Nov 2020 14:13:23 +0800 Subject: [PATCH] =?UTF-8?q?`=E7=9B=B8=E4=BC=BC=E6=AD=8C=E6=89=8B`,`?= =?UTF-8?q?=E9=A6=96=E9=A1=B5-=E5=8F=91=E7=8E=B0-=E5=9C=86=E5=BD=A2?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=85=A5=E5=8F=A3=E5=88=97=E8=A1=A8`?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E5=8C=BF=E5=90=8Dtoken=20#?= =?UTF-8?q?877,#988,=E4=BF=AE=E5=A4=8D`=E9=9F=B3=E4=B9=90=20url`=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3POST=E6=96=B9=E5=BC=8F=E6=89=8B=E5=8A=A8=E4=BC=A0?= =?UTF-8?q?=E5=85=A5cookie=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=20#1005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 5 +++++ module/homepage_dragon_ball.js | 6 ++++++ module/simi_artist.js | 7 ++++++- module/song_url.js | 5 ++++- package.json | 2 +- util/config.json | 3 +++ 6 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 util/config.json diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 80ea8a4..22e697c 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,4 +1,9 @@ # 更新日志 +### 3.45.3 | 2020.11.1 +- `相似歌手`,`首页-发现-圆形图标入口列表`接口增加匿名token[#877](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/877) [#988](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/988) + +- 修复`音乐 url`接口POST方式手动传入cookie报错问题 [#1005](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1005) + ### 3.45.2 | 2020.10.26 - 云贝完成任务接口增加`depositCode`参数 diff --git a/module/homepage_dragon_ball.js b/module/homepage_dragon_ball.js index 362062a..1749ca4 100644 --- a/module/homepage_dragon_ball.js +++ b/module/homepage_dragon_ball.js @@ -2,7 +2,13 @@ // 这个接口为移动端接口,首页-发现页(每日推荐、歌单、排行榜 那些入口) // 数据结构可以参考 https://github.com/hcanyz/flutter-netease-music-api/blob/master/lib/src/api/uncategorized/bean.dart#L290 HomeDragonBallWrap // !需要登录或者匿名登录,非登录返回 [] +const config = require('../util/config') module.exports = (query, request) => { + if (typeof query.cookie === 'string') { + query.cookie = cookieToJson(query.cookie) + } + if (!('MUSIC_U' in query.cookie)) + query.cookie.MUSIC_A = config.anonymous_token const data = {} return request( 'POST', diff --git a/module/simi_artist.js b/module/simi_artist.js index 555c1d9..0706424 100644 --- a/module/simi_artist.js +++ b/module/simi_artist.js @@ -1,6 +1,11 @@ // 相似歌手 - +const config = require('../util/config') module.exports = (query, request) => { + if (typeof query.cookie === 'string') { + query.cookie = cookieToJson(query.cookie) + } + if (!('MUSIC_U' in query.cookie)) + query.cookie.MUSIC_A = config.anonymous_token const data = { artistid: query.id, } diff --git a/module/song_url.js b/module/song_url.js index 2663165..49b5ed7 100644 --- a/module/song_url.js +++ b/module/song_url.js @@ -1,8 +1,11 @@ // 歌曲链接 const crypto = require('crypto') - +const { cookieToJson } = require('../util/index') module.exports = (query, request) => { + if (typeof query.cookie === 'string') { + query.cookie = cookieToJson(query.cookie) + } if (!('MUSIC_U' in query.cookie)) query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') query.cookie.os = 'pc' diff --git a/package.json b/package.json index 33ce1e7..7fff8c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "3.45.2", + "version": "3.45.3", "description": "网易云音乐 NodeJS 版 API", "scripts": { "start": "node app.js", diff --git a/util/config.json b/util/config.json new file mode 100644 index 0000000..96d5b80 --- /dev/null +++ b/util/config.json @@ -0,0 +1,3 @@ +{ + "anonymous_token": "8aae43f148f990410b9a2af38324af24e87ab9227c9265627ddd10145db744295fcd8701dc45b1ab8985e142f491516295dd965bae848761274a577a62b0fdc54a50284d1e434dcc04ca6d1a52333c9a" +}