mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
Merge pull request #1851 from akane/patch-1
update: song upload use up-to-date ip
This commit is contained in:
commit
ef7b1a935b
@ -8,12 +8,13 @@ module.exports = async (query, request) => {
|
|||||||
.replace('.' + ext, '')
|
.replace('.' + ext, '')
|
||||||
.replace(/\s/g, '')
|
.replace(/\s/g, '')
|
||||||
.replace(/\./g, '_')
|
.replace(/\./g, '_')
|
||||||
|
const bucket = 'jd-musicrep-privatecloud-audio-public'
|
||||||
// 获取key和token
|
// 获取key和token
|
||||||
const tokenRes = await request(
|
const tokenRes = await request(
|
||||||
'POST',
|
'POST',
|
||||||
`https://music.163.com/weapi/nos/token/alloc`,
|
`https://music.163.com/weapi/nos/token/alloc`,
|
||||||
{
|
{
|
||||||
bucket: 'jd-musicrep-privatecloud-audio-public',
|
bucket: bucket,
|
||||||
ext: ext,
|
ext: ext,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
local: false,
|
local: false,
|
||||||
@ -27,9 +28,13 @@ module.exports = async (query, request) => {
|
|||||||
// 上传
|
// 上传
|
||||||
const objectKey = tokenRes.body.result.objectKey.replace('/', '%2F')
|
const objectKey = tokenRes.body.result.objectKey.replace('/', '%2F')
|
||||||
try {
|
try {
|
||||||
|
const lbs = (await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://wanproxy.127.net/lbs?version=1.0&bucketname=${bucket}`,
|
||||||
|
})).data;
|
||||||
await axios({
|
await axios({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: `http://45.127.129.8/jd-musicrep-privatecloud-audio-public/${objectKey}?offset=0&complete=true&version=1.0`,
|
url: `http://${lbs.upload[0]}/${bucket}/${objectKey}?offset=0&complete=true&version=1.0`,
|
||||||
headers: {
|
headers: {
|
||||||
'x-nos-token': tokenRes.body.result.token,
|
'x-nos-token': tokenRes.body.result.token,
|
||||||
'Content-MD5': query.songFile.md5,
|
'Content-MD5': query.songFile.md5,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user