mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-10-22 22:53:09 +00:00
readme 修改成 https 克隆(不用登录 修改 /public 几个测试网页
去掉了 http://localhost:port/ public 里面的网页 lang 都改成 zh 了
This commit is contained in:
parent
9ee30f363a
commit
c05c83db14
@ -192,7 +192,7 @@
|
|||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ git clone git@github.com:Binaryify/NeteaseCloudMusicApi.git
|
$ git clone https://github.com/Binaryify/NeteaseCloudMusicApi.git
|
||||||
$ npm install
|
$ npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,80 +1,82 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh">
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>更新头像</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<input id="file" type="file" name="filename" />
|
|
||||||
<img id="avatar" style="height: 200px; width: 200px; border-radius: 50%;" />
|
|
||||||
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js
|
|
||||||
"></script>
|
|
||||||
<script>
|
|
||||||
const phone = ''
|
|
||||||
const password = ''
|
|
||||||
const port = 3000
|
|
||||||
let cookieToken = ''
|
|
||||||
if (!phone || !password) {
|
|
||||||
const msg = '请设置你的手机号码和密码'
|
|
||||||
alert(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
<head>
|
||||||
login()
|
<meta charset="UTF-8" />
|
||||||
async function main() {
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
document.querySelector('input[type="file"]').addEventListener(
|
<title>更新头像</title>
|
||||||
'change',
|
</head>
|
||||||
function (e) {
|
|
||||||
var file = this.files[0]
|
<body>
|
||||||
upload(file)
|
<input id="file" type="file" name="filename" />
|
||||||
},
|
<img id="avatar" style="height: 200px; width: 200px; border-radius: 50%;" />
|
||||||
false
|
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js
|
||||||
)
|
"></script>
|
||||||
const res = await axios({
|
<script>
|
||||||
url: `http://localhost:${port}/user/detail?uid=32953014×tamp=${Date.now()}`,
|
const phone = ''
|
||||||
withCredentials: true, //关键
|
const password = ''
|
||||||
})
|
let cookieToken = ''
|
||||||
document.querySelector('#avatar').src = res.data.profile.avatarUrl
|
if (!phone || !password) {
|
||||||
}
|
const msg = '请设置你的手机号码和密码'
|
||||||
async function login() {
|
alert(msg)
|
||||||
const res = await axios({
|
throw new Error(msg)
|
||||||
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
|
}
|
||||||
withCredentials: true, //关键
|
|
||||||
})
|
main()
|
||||||
cookieToken = res.data.cookie
|
login()
|
||||||
}
|
async function main() {
|
||||||
async function upload(file) {
|
document.querySelector('input[type="file"]').addEventListener(
|
||||||
var formData = new FormData()
|
'change',
|
||||||
formData.append('imgFile', file)
|
function (e) {
|
||||||
const imgSize = await getImgSize(file)
|
var file = this.files[0]
|
||||||
const res = await axios({
|
upload(file)
|
||||||
method: 'post',
|
},
|
||||||
url: `http://localhost:3000/avatar/upload?cookie=${cookieToken}&imgSize=${imgSize.width}&imgX=0&imgY=0×tamp=${Date.now()}`,
|
false
|
||||||
headers: {
|
)
|
||||||
'Content-Type': 'multipart/form-data',
|
const res = await axios({
|
||||||
},
|
url: `/user/detail?uid=32953014×tamp=${Date.now()}`,
|
||||||
data: formData,
|
withCredentials: true, //关键
|
||||||
})
|
})
|
||||||
document.querySelector('#avatar').src = res.data.data.url
|
document.querySelector('#avatar').src = res.data.profile.avatarUrl
|
||||||
}
|
}
|
||||||
function getImgSize(file) {
|
async function login() {
|
||||||
return new Promise((resolve, reject) => {
|
const res = await axios({
|
||||||
let reader = new FileReader()
|
url: `/login/cellphone?phone=${phone}&password=${password}`,
|
||||||
reader.readAsDataURL(file)
|
withCredentials: true, //关键
|
||||||
reader.onload = function (theFile) {
|
})
|
||||||
let image = new Image()
|
cookieToken = res.data.cookie
|
||||||
image.src = theFile.target.result
|
}
|
||||||
image.onload = function () {
|
async function upload(file) {
|
||||||
resolve({
|
var formData = new FormData()
|
||||||
width: this.width,
|
formData.append('imgFile', file)
|
||||||
height: this.height
|
const imgSize = await getImgSize(file)
|
||||||
})
|
const res = await axios({
|
||||||
}
|
method: 'post',
|
||||||
|
url: `http://localhost:3000/avatar/upload?cookie=${cookieToken}&imgSize=${imgSize.width}&imgX=0&imgY=0×tamp=${Date.now()}`,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
data: formData,
|
||||||
|
})
|
||||||
|
document.querySelector('#avatar').src = res.data.data.url
|
||||||
|
}
|
||||||
|
function getImgSize(file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let reader = new FileReader()
|
||||||
|
reader.readAsDataURL(file)
|
||||||
|
reader.onload = function (theFile) {
|
||||||
|
let image = new Image()
|
||||||
|
image.src = theFile.target.result
|
||||||
|
image.onload = function () {
|
||||||
|
resolve({
|
||||||
|
width: this.width,
|
||||||
|
height: this.height
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
</script>
|
}
|
||||||
</body>
|
</script>
|
||||||
</html>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,11 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="zh">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title>网易云音乐 API</title>
|
<title>网易云音乐 API</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>网易云音乐 API</h1>
|
<h1>网易云音乐 API</h1>
|
||||||
当你看到这个页面时,这个服务已经成功跑起来了~
|
当你看到这个页面时,这个服务已经成功跑起来了~
|
||||||
@ -17,32 +19,40 @@
|
|||||||
<li>3. <a href="/dj/program?rid=336355127">电台节目</a></li>
|
<li>3. <a href="/dj/program?rid=336355127">电台节目</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<style>
|
<style>
|
||||||
html,body{
|
html,
|
||||||
|
body {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top:30px;
|
margin-top: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
*{
|
|
||||||
color:rgb(100,100,100);
|
* {
|
||||||
|
color: rgb(100, 100, 100);
|
||||||
}
|
}
|
||||||
a{
|
|
||||||
color:#42b983;
|
a {
|
||||||
|
color: #42b983;
|
||||||
}
|
}
|
||||||
ul,li{
|
|
||||||
|
ul,
|
||||||
|
li {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
ul{
|
|
||||||
|
ul {
|
||||||
margin-left: -40px;
|
margin-left: -40px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
li{
|
|
||||||
|
li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,86 +1,88 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh">
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>歌单封面上传</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<input id="file" type="file" name="filename" />
|
|
||||||
<img id="playlist_cover" style="height: 200px; width: 200px; border-radius: 50%;" />
|
|
||||||
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js
|
|
||||||
"></script>
|
|
||||||
<script>
|
|
||||||
const phone = ''
|
|
||||||
const password = ''
|
|
||||||
const playlist_id = ''
|
|
||||||
const port = 3000
|
|
||||||
let cookieToken = ''
|
|
||||||
if (!phone || !password) {
|
|
||||||
const msg = '请设置你的手机号码和密码'
|
|
||||||
alert(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
if (!playlist_id) {
|
|
||||||
const msg = '请设置你的歌单id'
|
|
||||||
alert(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
<head>
|
||||||
login()
|
<meta charset="UTF-8" />
|
||||||
async function main() {
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
document.querySelector('input[type="file"]').addEventListener(
|
<title>歌单封面上传</title>
|
||||||
'change',
|
</head>
|
||||||
function (e) {
|
|
||||||
var file = this.files[0]
|
<body>
|
||||||
upload(file)
|
|
||||||
},
|
<input id="file" type="file" name="filename" />
|
||||||
false
|
<img id="playlist_cover" style="height: 200px; width: 200px; border-radius: 50%;" />
|
||||||
)
|
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js
|
||||||
const res = await axios({
|
"></script>
|
||||||
url: `http://localhost:${port}/playlist/detail?id=${playlist_id}×tamp=${Date.now()}`,
|
<script>
|
||||||
})
|
const phone = ''
|
||||||
document.querySelector('#playlist_cover').src = res.data.playlist.coverImgUrl
|
const password = ''
|
||||||
}
|
const playlist_id = ''
|
||||||
async function login() {
|
let cookieToken = ''
|
||||||
const res = await axios({
|
if (!phone || !password) {
|
||||||
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
|
const msg = '请设置你的手机号码和密码'
|
||||||
withCredentials: true, //关键
|
alert(msg)
|
||||||
})
|
throw new Error(msg)
|
||||||
cookieToken = res.data.cookie
|
}
|
||||||
}
|
if (!playlist_id) {
|
||||||
async function upload(file) {
|
const msg = '请设置你的歌单id'
|
||||||
var formData = new FormData()
|
alert(msg)
|
||||||
formData.append('imgFile', file)
|
throw new Error(msg)
|
||||||
const imgSize = await getImgSize(file)
|
}
|
||||||
const res = await axios({
|
|
||||||
method: 'post',
|
main()
|
||||||
url: `http://localhost:3000/playlist/cover/update?id=${playlist_id}&cookie=${cookieToken}&imgSize=${imgSize.width}&imgX=0&imgY=0×tamp=${Date.now()}`,
|
login()
|
||||||
headers: {
|
async function main() {
|
||||||
'Content-Type': 'multipart/form-data',
|
document.querySelector('input[type="file"]').addEventListener(
|
||||||
},
|
'change',
|
||||||
data: formData,
|
function (e) {
|
||||||
})
|
var file = this.files[0]
|
||||||
document.querySelector('#playlist_cover').src = res.data.data.url
|
upload(file)
|
||||||
}
|
},
|
||||||
function getImgSize(file) {
|
false
|
||||||
return new Promise((resolve, reject) => {
|
)
|
||||||
let reader = new FileReader()
|
const res = await axios({
|
||||||
reader.readAsDataURL(file)
|
url: `/playlist/detail?id=${playlist_id}×tamp=${Date.now()}`,
|
||||||
reader.onload = function (theFile) {
|
})
|
||||||
let image = new Image()
|
document.querySelector('#playlist_cover').src = res.data.playlist.coverImgUrl
|
||||||
image.src = theFile.target.result
|
}
|
||||||
image.onload = function () {
|
async function login() {
|
||||||
resolve({
|
const res = await axios({
|
||||||
width: this.width,
|
url: `/login/cellphone?phone=${phone}&password=${password}`,
|
||||||
height: this.height,
|
withCredentials: true, //关键
|
||||||
})
|
})
|
||||||
}
|
cookieToken = res.data.cookie
|
||||||
|
}
|
||||||
|
async function upload(file) {
|
||||||
|
var formData = new FormData()
|
||||||
|
formData.append('imgFile', file)
|
||||||
|
const imgSize = await getImgSize(file)
|
||||||
|
const res = await axios({
|
||||||
|
method: 'post',
|
||||||
|
url: `http://localhost:3000/playlist/cover/update?id=${playlist_id}&cookie=${cookieToken}&imgSize=${imgSize.width}&imgX=0&imgY=0×tamp=${Date.now()}`,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
data: formData,
|
||||||
|
})
|
||||||
|
document.querySelector('#playlist_cover').src = res.data.data.url
|
||||||
|
}
|
||||||
|
function getImgSize(file) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let reader = new FileReader()
|
||||||
|
reader.readAsDataURL(file)
|
||||||
|
reader.onload = function (theFile) {
|
||||||
|
let image = new Image()
|
||||||
|
image.src = theFile.target.result
|
||||||
|
image.onload = function () {
|
||||||
|
resolve({
|
||||||
|
width: this.width,
|
||||||
|
height: this.height,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
</script>
|
}
|
||||||
</body>
|
</script>
|
||||||
</html>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
119
public/test.html
119
public/test.html
@ -1,62 +1,63 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh">
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
||||||
<title>test</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<head>
|
||||||
<p>请在控制台看结果</p>
|
<meta charset="UTF-8" />
|
||||||
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||||
<script>
|
<title>test</title>
|
||||||
const phone = ''
|
</head>
|
||||||
const password = ''
|
|
||||||
const port = 3000
|
|
||||||
if(!phone || !password){
|
|
||||||
const msg = '请设置你的手机号码和密码'
|
|
||||||
alert(msg)
|
|
||||||
throw new Error(msg)
|
|
||||||
}
|
|
||||||
$.ajax({
|
|
||||||
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
|
|
||||||
xhrFields: {
|
|
||||||
withCredentials: true //关键
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
console.log(data)
|
|
||||||
$.ajax({
|
|
||||||
url: `http://localhost:${port}/recommend/resource `,
|
|
||||||
xhrFields: {
|
|
||||||
withCredentials: true //关键
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
console.log(data)
|
|
||||||
},
|
|
||||||
error: function(err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
error: function(err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
axios({
|
<body>
|
||||||
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
|
<p>请在控制台看结果</p>
|
||||||
withCredentials: true //关键
|
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||||
}).then(function(res) {
|
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
|
||||||
console.log(res.data)
|
<script>
|
||||||
axios({
|
const phone = ''
|
||||||
url: `http://localhost:${port}/recommend/resource`,
|
const password = ''
|
||||||
withCredentials: true //关键
|
if (!phone || !password) {
|
||||||
}).then(function(res) {
|
const msg = '请设置你的手机号码和密码'
|
||||||
console.log(res.data)
|
alert(msg)
|
||||||
})
|
throw new Error(msg)
|
||||||
})
|
}
|
||||||
</script>
|
$.ajax({
|
||||||
</body>
|
url: `/login/cellphone?phone=${phone}&password=${password}`,
|
||||||
</html>
|
xhrFields: {
|
||||||
|
withCredentials: true //关键
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data)
|
||||||
|
$.ajax({
|
||||||
|
url: `/recommend/resource `,
|
||||||
|
xhrFields: {
|
||||||
|
withCredentials: true //关键
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data)
|
||||||
|
},
|
||||||
|
error: function (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
error: function (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
axios({
|
||||||
|
url: `/login/cellphone?phone=${phone}&password=${password}`,
|
||||||
|
withCredentials: true //关键
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res.data)
|
||||||
|
axios({
|
||||||
|
url: `/recommend/resource`,
|
||||||
|
withCredentials: true //关键
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res.data)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user