update: 状态码判断完善,补充verify相关接口 #1783

This commit is contained in:
binaryify 2023-08-21 10:19:17 +08:00
parent 7f21fbcda1
commit 5a0bdfb171
5 changed files with 75 additions and 6 deletions

View File

@ -1,4 +1,9 @@
# 更新日志 # 更新日志
### 4.9.3 | 2023.08.21
- 禁用NMTID #1788
- 状态码判断完善,补充verify相关接口 #1783
- 增加对带用户名密码的代理支持 #1787
### 4.9.2 | 2023.08.15 ### 4.9.2 | 2023.08.15
- 补充 `/vip/info/v2` 接口 - 补充 `/vip/info/v2` 接口

View File

@ -489,9 +489,9 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
不要频繁调登录接口,不然可能会被风控,登录状态还存在就不要重复调登录接口 不要频繁调登录接口,不然可能会被风控,登录状态还存在就不要重复调登录接口
因网易增加了网易云盾验证,密码登录暂时不要使用,尽量使用短信验证码登录和二维码登录,否则调用某些接口会触发需要验证的错误 ~~因网易增加了网易云盾验证,密码登录暂时不要使用,尽量使用短信验证码登录和二维码登录,否则调用某些接口会触发需要验证的错误~~
#### 1. 手机登录(现在要求验证,暂时绕不过,请使用二维码登录) #### 1. 手机登录
**必选参数 :** **必选参数 :**
`phone`: 手机号码 `phone`: 手机号码
@ -509,7 +509,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy` `/login/cellphone?phone=xxx&captcha=1234` **调用例子 :** `/login/cellphone?phone=xxx&password=yyy` `/login/cellphone?phone=xxx&md5_password=yyy` `/login/cellphone?phone=xxx&captcha=1234`
#### 2. 邮箱登录(现在要求验证,暂时绕不过,请使用二维码登录) #### 2. 邮箱登录
**必选参数 :** **必选参数 :**

42
module/verify_getQr.js Normal file
View File

@ -0,0 +1,42 @@
module.exports = async (query, request) => {
const data = {
verifyConfigId: query.vid,
verifyType: query.type,
token: query.token,
params: JSON.stringify({
event_id: query.evid,
sign: query.sign,
}),
size: 150,
}
const res = await request(
'POST',
`https://music.163.com/weapi/frontrisk/verify/getqrcode`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
const result = `https://st.music.163.com/encrypt-pages?qrCode=${
res.body.data.qrCode
}&verifyToken=${query.token}&verifyId=${query.vid}&verifyType=${
query.type
}&params=${JSON.stringify({
event_id: query.evid,
sign: query.sign,
})}`
return {
status: 200,
body: {
code: 200,
data: {
qrCode: res.body.data.qrCode,
qrurl: result,
},
},
}
}

View File

@ -0,0 +1,17 @@
module.exports = async (query, request) => {
const data = {
qrCode: query.qr,
}
const res = await request(
'POST',
`https://music.163.com/weapi/frontrisk/verify/qrcodestatus`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
return res
}

View File

@ -147,11 +147,16 @@ const createRequest = (method, url, data = {}, options) => {
} else { } else {
const purl = new URL(options.proxy) const purl = new URL(options.proxy)
if (purl.hostname) { if (purl.hostname) {
const agent = tunnel[purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp']({ const agent = tunnel[
purl.protocol === 'https' ? 'httpsOverHttp' : 'httpOverHttp'
]({
proxy: { proxy: {
host: purl.hostname, host: purl.hostname,
port: purl.port || 80, port: purl.port || 80,
proxyAuth: purl.username && purl.password ? (purl.username + ':' + purl.password) : '' proxyAuth:
purl.username && purl.password
? purl.username + ':' + purl.password
: '',
}, },
}) })
settings.httpsAgent = agent settings.httpsAgent = agent
@ -183,7 +188,7 @@ const createRequest = (method, url, data = {}, options) => {
answer.body = body answer.body = body
} }
answer.status = answer.body.code || res.status answer.status = Number(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) >
-1 -1