mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
修复 eapi 接口无法正确解密response的问题 #1138
This commit is contained in:
parent
d289f6332d
commit
1eb178d0e4
@ -1,4 +1,7 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
### 4.0.6 | 2021.2.20
|
||||||
|
- 修复 eapi 接口无法正确解密response的问题 [#1138](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1138)
|
||||||
|
|
||||||
### 4.0.5 | 2021.2.19
|
### 4.0.5 | 2021.2.19
|
||||||
- 修复红心接口默认不红心的问题 [#1126](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1126)
|
- 修复红心接口默认不红心的问题 [#1126](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1126)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NeteaseCloudMusicApi",
|
"name": "NeteaseCloudMusicApi",
|
||||||
"version": "4.0.5",
|
"version": "4.0.6",
|
||||||
"description": "网易云音乐 NodeJS 版 API",
|
"description": "网易云音乐 NodeJS 版 API",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node app.js",
|
"start": "node app.js",
|
||||||
|
@ -111,7 +111,7 @@ const createRequest = (method, url, data, options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const answer = { status: 500, body: {}, cookie: [] }
|
const answer = { status: 500, body: {}, cookie: [] }
|
||||||
const settings = {
|
let settings = {
|
||||||
method: method,
|
method: method,
|
||||||
url: url,
|
url: url,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
@ -143,7 +143,12 @@ const createRequest = (method, url, data, options) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (options.crypto === 'eapi') {
|
||||||
|
settings = {
|
||||||
|
...settings,
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
}
|
||||||
|
}
|
||||||
axios(settings)
|
axios(settings)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const body = res.data
|
const body = res.data
|
||||||
@ -151,7 +156,12 @@ const createRequest = (method, url, data, options) => {
|
|||||||
x.replace(/\s*Domain=[^(;|$)]+;*/, ''),
|
x.replace(/\s*Domain=[^(;|$)]+;*/, ''),
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
|
if (options.crypto === 'eapi') {
|
||||||
|
answer.body = JSON.parse(encrypt.decrypt(body).toString())
|
||||||
|
} else {
|
||||||
answer.body = body
|
answer.body = body
|
||||||
|
}
|
||||||
|
|
||||||
answer.status = answer.body.code || res.status
|
answer.status = answer.body.code || res.status
|
||||||
if (
|
if (
|
||||||
[201, 302, 400, 502, 800, 801, 802, 803].indexOf(answer.body.code) >
|
[201, 302, 400, 502, 800, 801, 802, 803].indexOf(answer.body.code) >
|
||||||
@ -161,6 +171,7 @@ const createRequest = (method, url, data, options) => {
|
|||||||
answer.status = 200
|
answer.status = 200
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// console.log(e)
|
||||||
answer.body = body
|
answer.body = body
|
||||||
answer.status = res.status
|
answer.status = res.status
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user