mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-05 20:08:55 +08:00
commit
2311b90743
@ -227,6 +227,8 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
|
|||||||
|
|
||||||
**接口地址 :** `/login/cellphone`
|
**接口地址 :** `/login/cellphone`
|
||||||
|
|
||||||
|
**可选参数 :** `countrycode`: 国家码,用于国外手机号登陆,例如美国传入:`1`
|
||||||
|
|
||||||
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy`
|
**调用例子 :** `/login/cellphone?phone=xxx&password=yyy`
|
||||||
|
|
||||||
#### 2. 邮箱登录
|
#### 2. 邮箱登录
|
||||||
|
@ -5,6 +5,7 @@ const crypto = require('crypto')
|
|||||||
module.exports = (query, request) => {
|
module.exports = (query, request) => {
|
||||||
const data = {
|
const data = {
|
||||||
phone: query.phone,
|
phone: query.phone,
|
||||||
|
countrycode: query.countrycode,
|
||||||
password: crypto.createHash('md5').update(query.password).digest('hex'),
|
password: crypto.createHash('md5').update(query.password).digest('hex'),
|
||||||
rememberLogin: 'true'
|
rememberLogin: 'true'
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apicache": "^1.2.1",
|
"apicache": "^1.2.1",
|
||||||
"express": "^4.16.3",
|
"express": "^4.16.3",
|
||||||
|
"pac-proxy-agent": "^3.0.0",
|
||||||
"request": "^2.85.0"
|
"request": "^2.85.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const encrypt = require('./crypto')
|
const encrypt = require('./crypto')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
const queryString = require('querystring')
|
const queryString = require('querystring')
|
||||||
|
const PacProxyAgent = require('pac-proxy-agent')
|
||||||
|
|
||||||
// request.debug = true // 开启可看到更详细信息
|
// request.debug = true // 开启可看到更详细信息
|
||||||
|
|
||||||
@ -67,14 +68,21 @@ const createRequest = (method, url, data, options) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const answer = { status: 500, body: {}, cookie: [] }
|
const answer = { status: 500, body: {}, cookie: [] }
|
||||||
|
const settings = {
|
||||||
|
method: method,
|
||||||
|
url: url,
|
||||||
|
headers: headers,
|
||||||
|
body: queryString.stringify(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/\.pac$/i.test(options.proxy)) {
|
||||||
|
settings.agent = new PacProxyAgent(options.proxy)
|
||||||
|
} else {
|
||||||
|
settings.proxy = options.proxy
|
||||||
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
{
|
settings,
|
||||||
method: method,
|
|
||||||
url: url,
|
|
||||||
headers: headers,
|
|
||||||
body: queryString.stringify(data),
|
|
||||||
proxy: options.proxy
|
|
||||||
},
|
|
||||||
(err, res, body) => {
|
(err, res, body) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
answer.status = 502
|
answer.status = 502
|
||||||
|
Loading…
x
Reference in New Issue
Block a user