mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-10-22 14:43:10 +00:00
修复无法使用邮箱问题
This commit is contained in:
parent
2cdec0ac64
commit
ea6cfefb69
@ -1,4 +1,7 @@
|
||||
# 更新日志
|
||||
### 2.14.0 | 2018.07.03
|
||||
修复无法使用邮箱问题
|
||||
|
||||
### 2.13.0 | 2018.06.05
|
||||
增加自动注册路由的功能,简化路由注册逻辑
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
跨站请求伪造 (CSRF), 伪造请求头 , 调用官方 API
|
||||
|
||||
## 版本新特性
|
||||
### 2.14.0 | 2018.07.03
|
||||
修复无法使用邮箱问题
|
||||
|
||||
### 2.11.0 | 2018.05.21
|
||||
增加收藏歌手列表&订阅电台列表
|
||||
|
||||
@ -236,6 +239,7 @@ $ sudo docker run -d -p 3000:3000 netease-music-api
|
||||
#### 2. 邮箱登录
|
||||
|
||||
> 注意 : 此接口被网易和谐了 , 待修复 , 暂时使用手机登录 (2017.05.20)
|
||||
> 更新 : 此接口已经可以正常使用(2018.07.03)
|
||||
|
||||
**必选参数 :** `email`: 163 网易邮箱 `password`: 密码
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NeteaseCloudMusicApi",
|
||||
"version": "2.13.1",
|
||||
"version": "2.14.0",
|
||||
"description": "网易云音乐 NodeJS 版 API",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
|
@ -1,35 +1,32 @@
|
||||
const crypto = require("crypto");
|
||||
const crypto = require('crypto')
|
||||
|
||||
//邮箱登录
|
||||
module.exports = (req, res, createWebAPIRequest, request) => {
|
||||
const email = req.query.email;
|
||||
const cookie = req.get("Cookie") ? req.get("Cookie") : "";
|
||||
const md5sum = crypto.createHash("md5");
|
||||
md5sum.update(req.query.password);
|
||||
const email = req.query.email
|
||||
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
|
||||
const md5sum = crypto.createHash('md5')
|
||||
md5sum.update(req.query.password)
|
||||
const data = {
|
||||
username: email,
|
||||
password: md5sum.digest("hex"),
|
||||
rememberLogin: "true",
|
||||
clientToken:
|
||||
"1_jVUMqWEPke0/1/Vu56xCmJpo5vP1grjn_SOVVDzOc78w8OKLVZ2JH7IfkjSXqgfmh"
|
||||
};
|
||||
console.log(email, req.query.password);
|
||||
password: md5sum.digest('hex'),
|
||||
rememberLogin: 'true'
|
||||
}
|
||||
console.log(email, req.query.password)
|
||||
|
||||
createWebAPIRequest(
|
||||
"music.163.com",
|
||||
"/weapi/login?csrf_token=",
|
||||
"POST",
|
||||
'music.163.com',
|
||||
'/weapi/login',
|
||||
'POST',
|
||||
data,
|
||||
cookie,
|
||||
(music_req, cookie) => {
|
||||
// console.log(music_req)
|
||||
cookie =
|
||||
cookie && cookie.map(x => x.replace("Domain=.music.163.com", ""));
|
||||
cookie = cookie && cookie.map(x => x.replace('Domain=.music.163.com', ''))
|
||||
res.set({
|
||||
"Set-Cookie": cookie
|
||||
});
|
||||
res.send(music_req);
|
||||
'Set-Cookie': cookie
|
||||
})
|
||||
res.send(music_req)
|
||||
},
|
||||
err => res.status(502).send("fetch error")
|
||||
);
|
||||
};
|
||||
err => res.status(502).send('fetch error')
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user