mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-03 19:02:08 +08:00
Merge branch 'master' of github.com:Binaryify/NeteaseCloudMusicApi
This commit is contained in:
commit
25cc98fed3
20
package-lock.json
generated
20
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NeteaseCloudMusicApi",
|
"name": "NeteaseCloudMusicApi",
|
||||||
"version": "4.0.2",
|
"version": "4.0.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -132,9 +132,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.14.21",
|
"version": "14.14.25",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
|
||||||
"integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A=="
|
"integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ=="
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@ -1293,9 +1293,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "7.18.0",
|
"version": "7.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz",
|
||||||
"integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==",
|
"integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
@ -1832,9 +1832,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flatted": {
|
"flatted": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
|
||||||
"integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==",
|
"integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"follow-redirects": {
|
"follow-redirects": {
|
||||||
|
@ -46,10 +46,10 @@
|
|||||||
"tunnel": "^0.0.6"
|
"tunnel": "^0.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "14.14.21",
|
"@types/node": "14.14.25",
|
||||||
"@typescript-eslint/eslint-plugin": "4.4.1",
|
"@typescript-eslint/eslint-plugin": "4.4.1",
|
||||||
"@typescript-eslint/parser": "4.4.1",
|
"@typescript-eslint/parser": "4.4.1",
|
||||||
"eslint": "7.18.0",
|
"eslint": "7.19.0",
|
||||||
"eslint-config-prettier": "7.1.0",
|
"eslint-config-prettier": "7.1.0",
|
||||||
"eslint-plugin-html": "6.0.3",
|
"eslint-plugin-html": "6.0.3",
|
||||||
"eslint-plugin-prettier": "3.3.1",
|
"eslint-plugin-prettier": "3.3.1",
|
||||||
|
@ -1,55 +1,78 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh">
|
<html lang="zh">
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>云盘上传</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
<head>
|
||||||
<input id="file" type="file" accept="audio/mpeg" />
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>云盘上传</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
|
<body>
|
||||||
<script>
|
<input id="file" type="file" multiple/>
|
||||||
|
|
||||||
const phone = ''
|
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
|
||||||
const password = ''
|
<script>
|
||||||
let cookieToken = ''
|
const phone = '' // 这里填手机号
|
||||||
if (!phone || !password) {
|
const password = '' // 这里填密码
|
||||||
const msg = '请设置你的手机号码和密码'
|
const fileUpdateTime = {}
|
||||||
alert(msg)
|
let fileLength = 0
|
||||||
throw new Error(msg)
|
let cookieToken = ''
|
||||||
}
|
if (!phone || !password) {
|
||||||
login()
|
const msg = '请设置你的手机号码和密码'
|
||||||
main()
|
alert(msg)
|
||||||
async function login() {
|
throw new Error(msg)
|
||||||
const res = await axios({
|
}
|
||||||
url: `/login/cellphone?phone=${phone}&password=${password}`,
|
login()
|
||||||
withCredentials: true, //关键
|
main()
|
||||||
|
async function login() {
|
||||||
|
const res = await axios({
|
||||||
|
url: `/login/cellphone?phone=${phone}&password=${encodeURIComponent(password)}`,
|
||||||
|
withCredentials: true, //关键
|
||||||
|
})
|
||||||
|
cookieToken = res.data.cookie
|
||||||
|
}
|
||||||
|
function main() {
|
||||||
|
document
|
||||||
|
.querySelector('input[type="file"]')
|
||||||
|
.addEventListener('change', function (e) {
|
||||||
|
console.log(this.files)
|
||||||
|
let currentIndx = 0
|
||||||
|
fileLength = this.files.length
|
||||||
|
for (const item of this.files) {
|
||||||
|
currentIndx += 1
|
||||||
|
upload(item, currentIndx)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
cookieToken = res.data.cookie
|
}
|
||||||
}
|
|
||||||
async function main() {
|
|
||||||
document
|
|
||||||
.querySelector('input[type="file"]')
|
|
||||||
.addEventListener('change', function (e) {
|
|
||||||
var file = this.files[0]
|
|
||||||
upload(file)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function upload(file) {
|
function upload(file, currentIndx) {
|
||||||
var formData = new FormData()
|
var formData = new FormData()
|
||||||
formData.append('songFile', file)
|
formData.append('songFile', file)
|
||||||
const res = await axios({
|
axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: `http://localhost:3000/cloud?time=${Date.now()}`,
|
url: `http://localhost:3000/cloud?time=${Date.now()}`,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
},
|
},
|
||||||
data: formData,
|
data: formData,
|
||||||
})
|
}).then(res => {
|
||||||
}
|
console.log(`${file.name} 上传成功`)
|
||||||
</script>
|
if (currentIndx >= fileLength) { console.log('上传完毕') }
|
||||||
</body>
|
}).catch(async err => {
|
||||||
</html>
|
console.log(err)
|
||||||
|
console.log(fileUpdateTime)
|
||||||
|
fileUpdateTime[file.name] ? fileUpdateTime[file.name] += 1 : fileUpdateTime[file.name] = 1
|
||||||
|
if (fileUpdateTime[file.name] >= 4) {
|
||||||
|
console.error(`丢,这首歌怎么都传不上:${file.name}`)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
console.error(`${file.name} 失败 ${fileUpdateTime[file.name]} 次`)
|
||||||
|
}
|
||||||
|
await login()
|
||||||
|
upload(file, currentIndx)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user