mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-07 00:42:08 +08:00
修复代理配置失效的问题 #992,修复新碟上架不返回周数据的问题,修复推荐新音乐接口返回数量问题,并添加limit参数支持 #981, 添加云贝
相关接口 #985,添加用户账号信息
接口,替换接口文件所有http url 为 https
This commit is contained in:
@ -4,11 +4,11 @@ const queryString = require('querystring')
|
||||
const PacProxyAgent = require('pac-proxy-agent')
|
||||
const http = require('http')
|
||||
const https = require('https')
|
||||
|
||||
const tunnel = require('tunnel')
|
||||
const qs = require('url')
|
||||
// request.debug = true // 开启可看到更详细信息
|
||||
|
||||
const chooseUserAgent = (ua = false) => {
|
||||
// UA 列表要经常更新啊
|
||||
const userAgentList = {
|
||||
mobile: [
|
||||
// iOS 13.5.1 14.0 beta with safari
|
||||
@ -122,11 +122,26 @@ const createRequest = (method, url, data, options) => {
|
||||
|
||||
if (options.crypto === 'eapi') settings.encoding = null
|
||||
|
||||
if (/\.pac$/i.test(options.proxy)) {
|
||||
settings.httpAgent = new PacProxyAgent(options.proxy)
|
||||
settings.httpsAgent = new PacProxyAgent(options.proxy)
|
||||
} else {
|
||||
settings.proxy = options.proxy
|
||||
if (options.proxy) {
|
||||
if (options.proxy.indexOf('pac') > -1) {
|
||||
settings.httpAgent = new PacProxyAgent(options.proxy)
|
||||
settings.httpsAgent = new PacProxyAgent(options.proxy)
|
||||
} else {
|
||||
var purl = qs.parse(options.proxy)
|
||||
if (purl.hostname) {
|
||||
const agent = tunnel.httpsOverHttp({
|
||||
proxy: {
|
||||
host: purl.hostname,
|
||||
port: purl.port || 80,
|
||||
},
|
||||
})
|
||||
settings.httpsAgent = agent
|
||||
settings.httpAgent = agent
|
||||
settings.proxy = false
|
||||
} else {
|
||||
console.error('代理配置无效,不使用代理')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
axios(settings)
|
||||
|
Reference in New Issue
Block a user