mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-07 07:32:08 +08:00
fix parameters error
This commit is contained in:
@ -2,7 +2,6 @@ const encrypt = require('./crypto')
|
|||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const queryString = require('querystring')
|
const queryString = require('querystring')
|
||||||
const PacProxyAgent = require('pac-proxy-agent')
|
const PacProxyAgent = require('pac-proxy-agent')
|
||||||
const zlib = require('zlib')
|
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const https = require('https')
|
const https = require('https')
|
||||||
|
|
||||||
@ -137,37 +136,14 @@ const createRequest = (method, url, data, options) => {
|
|||||||
x.replace(/\s*Domain=[^(;|$)]+;*/, ''),
|
x.replace(/\s*Domain=[^(;|$)]+;*/, ''),
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
if (options.crypto === 'eapi') {
|
answer.body = body
|
||||||
zlib.unzip(body, function (err, buffer) {
|
answer.status = answer.body.code || res.status
|
||||||
const _buffer = err ? body : buffer
|
if (answer.body.code === 502) {
|
||||||
try {
|
answer.status = 200
|
||||||
try {
|
|
||||||
answer.body = JSON.parse(encrypt.decrypt(_buffer).toString())
|
|
||||||
answer.status = answer.body.code || res.statusCode
|
|
||||||
} catch (e) {
|
|
||||||
answer.body = JSON.parse(_buffer.toString())
|
|
||||||
answer.status = res.statusCode
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
answer.body = _buffer.toString()
|
|
||||||
answer.status = res.statusCode
|
|
||||||
}
|
|
||||||
answer.status =
|
|
||||||
100 < answer.status && answer.status < 600 ? answer.status : 400
|
|
||||||
if (answer.status === 200) resolve(answer)
|
|
||||||
else reject(answer)
|
|
||||||
})
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
answer.body = JSON.parse(body)
|
|
||||||
answer.status = answer.body.code || res.statusCode
|
|
||||||
if (answer.body.code === 502) {
|
|
||||||
answer.status = 200
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
answer.body = body
|
answer.body = body
|
||||||
answer.status = res.statusCode
|
answer.status = res.status
|
||||||
}
|
}
|
||||||
|
|
||||||
answer.status =
|
answer.status =
|
||||||
|
Reference in New Issue
Block a user