fix: 云盘无法上传的bug

master
qier222 3 years ago
parent dd65c67568
commit aa418cd0d7
No known key found for this signature in database
GPG Key ID: 9C85007ED905F14D

@ -0,0 +1,15 @@
// 歌手粉丝
module.exports = (query, request) => {
const data = {
id: query.id,
limit: query.limit || 20,
offset: query.offset || 0,
}
return request('POST', `https://music.163.com/weapi/artist/fans/get`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}

@ -0,0 +1,20 @@
module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '8.1.20'
const data = {
userId: query.uid,
songId: query.sid,
adjustSongId: query.asid,
}
return request(
'POST',
`https://music.163.com/api/cloud/user/song/match`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,18 @@
// 数字专辑详情
module.exports = (query, request) => {
const data = {
id: query.id,
}
return request(
'POST',
`https://music.163.com/weapi/vipmall/albumproduct/detail`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,18 @@
// 数字专辑销量
module.exports = (query, request) => {
const data = {
albumIds: query.ids,
}
return request(
'POST',
`https://music.163.com/weapi/vipmall/albumproduct/album/query/sales`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -4,7 +4,7 @@
module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '8.1.20'
const data = { refresh: query.refresh || true }
const data = { refresh: query.refresh || false, cursor: query.cursor }
return request(
'POST',
`https://music.163.com/api/homepage/block/page`,

@ -4,9 +4,6 @@
// !需要登录或者匿名登录,非登录返回 []
const config = require('../util/config.json')
module.exports = (query, request) => {
if (typeof query.cookie === 'string') {
query.cookie = cookieToJson(query.cookie)
}
if (!('MUSIC_U' in query.cookie))
query.cookie.MUSIC_A = config.anonymous_token
const data = {}

@ -0,0 +1,15 @@
// 一起听状态
module.exports = (query, request) => {
return request(
'POST',
`https://music.163.com/api/listen/together/status/get`,
{},
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -7,9 +7,11 @@ module.exports = async (query, request) => {
const data = {
phone: query.phone,
countrycode: query.countrycode || '86',
password:
query.md5_password ||
crypto.createHash('md5').update(query.password).digest('hex'),
captcha: query.captcha,
[query.captcha ? 'captcha' : 'password']: query.captcha
? query.captcha
: query.md5_password ||
crypto.createHash('md5').update(query.password).digest('hex'),
rememberLogin: 'true',
}
let result = await request(

@ -0,0 +1,23 @@
// 歌曲相关视频
module.exports = (query, request) => {
const data = {
id: query.mvid || 0,
type: 2,
rcmdType: 20,
limit: query.limit || 10,
extInfo: JSON.stringify({ songId: query.songid }),
}
return request(
'POST',
`https://interface.music.163.com/eapi/mlog/rcmd/feed/list`,
data,
{
crypto: 'eapi',
cookie: query.cookie,
proxy: query.proxy,
url: '/api/mlog/rcmd/feed/list',
realIP: query.realIP,
},
)
}

@ -0,0 +1,18 @@
// 将mlog id转为video id
module.exports = (query, request) => {
const data = {
mlogId: query.id,
}
return request(
'POST',
`https://music.163.com/weapi/mlog/video/convert/id`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,15 @@
// mlog链接
module.exports = (query, request) => {
const data = {
id: query.id,
resolution: query.res || 1080,
type: 1,
}
return request('POST', `https://music.163.com/weapi/mlog/detail/v1`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}

@ -0,0 +1,11 @@
// 账号云豆数
module.exports = (query, request) => {
const data = {}
return request('POST', `https://music.163.com/weapi/cloudbean/get`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}

@ -0,0 +1,19 @@
// 领取云豆
module.exports = (query, request) => {
const data = {
userMissionId: query.id,
period: query.period,
}
return request(
'POST',
`https://music.163.com/weapi/nmusician/workbench/mission/reward/obtain/new`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,16 @@
// 音乐人数据概况
module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/creator/musician/statistic/data/overview/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,19 @@
// 音乐人歌曲播放趋势
module.exports = (query, request) => {
const data = {
startTime: query.startTime,
endTime: query.endTime,
}
return request(
'POST',
`https://music.163.com/weapi/creator/musician/play/count/statistic/data/trend/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,16 @@
// 音乐人签到
module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/creator/user/access`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,16 @@
// 获取音乐人任务
module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/nmusician/workbench/mission/cycle/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -1,6 +1,7 @@
// 推荐新歌
module.exports = (query, request) => {
query.cookie.os = 'pc'
const data = {
type: 'recommend',
limit: query.limit || 10,
@ -8,7 +9,7 @@ module.exports = (query, request) => {
}
return request(
'POST',
`https://music.163.com/weapi/personalized/newsong`,
`https://music.163.com/api/personalized/newsong`,
data,
{
crypto: 'weapi',

@ -0,0 +1,20 @@
// 公开隐私歌单
module.exports = (query, request) => {
const data = {
id: query.id,
privacy: 0,
}
return request(
'POST',
`https://interface.music.163.com/eapi/playlist/update/privacy`,
data,
{
crypto: 'eapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
url: '/api/playlist/update/privacy',
},
)
}

@ -13,7 +13,8 @@ module.exports = (query, request) => {
},
).then((response) => {
try {
const pattern = /<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
const pattern =
/<div class="cver u-cover u-cover-3">[\s\S]*?<img src="([^"]+)">[\s\S]*?<a class="sname f-fs1 s-fc0" href="([^"]+)"[^>]*>([^<]+?)<\/a>[\s\S]*?<a class="nm nm f-thide s-fc3" href="([^"]+)"[^>]*>([^<]+?)<\/a>/g
let result,
playlists = []
while ((result = pattern.exec(response.body)) != null) {

@ -1,9 +1,6 @@
// 相似歌手
const config = require('../util/config.json')
module.exports = (query, request) => {
if (typeof query.cookie === 'string') {
query.cookie = cookieToJson(query.cookie)
}
if (!('MUSIC_U' in query.cookie))
query.cookie.MUSIC_A = config.anonymous_token
const data = {

@ -5,7 +5,7 @@ module.exports = (query, request) => {
const data = {
c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']',
}
return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, {
return request('POST', `https://music.163.com/api/v3/song/detail`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,

@ -0,0 +1,19 @@
// 已购单曲
module.exports = (query, request) => {
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}
return request(
'POST',
`https://music.163.com/weapi/single/mybought/song/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -1,11 +1,7 @@
// 歌曲链接
const crypto = require('crypto')
const { cookieToJson } = require('../util/index')
module.exports = (query, request) => {
if (typeof query.cookie === 'string') {
query.cookie = cookieToJson(query.cookie)
}
if (!('MUSIC_U' in query.cookie))
query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex')
query.cookie.os = 'pc'

@ -0,0 +1,22 @@
module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '8.1.20'
const data = {
compose_reminder: 'true',
compose_hot_comment: 'true',
limit: query.limit || 10,
user_id: query.uid,
time: query.time || 0,
}
return request(
'POST',
`https://music.163.com/api/comment/user/comment/history`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,16 @@
// 会员成长值
module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,19 @@
// 会员成长值领取记录
module.exports = (query, request) => {
const data = {
limit: query.limit || 20,
offset: query.offset || 0,
}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/growth/details`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,18 @@
// 领取会员成长值
module.exports = (query, request) => {
const data = {
taskIds: query.ids,
}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,15 @@
// 获取 VIP 信息
module.exports = (query, request) => {
return request(
'POST',
`https://music.163.com/weapi/music-vip-membership/front/vip/info`,
{},
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,16 @@
// 会员任务
module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/weapi/vipnewcenter/app/level/task/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,21 @@
// 云贝推歌
module.exports = (query, request) => {
const data = {
songId: query.id,
reason: query.reason || '好歌献给你',
scene: '',
fromUserId: -1,
}
return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/submit`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -0,0 +1,21 @@
// 云贝推歌历史记录
module.exports = (query, request) => {
const data = {
page: JSON.stringify({
size: query.size || 20,
cursor: query.cursor || '',
}),
}
return request(
'POST',
`https://music.163.com/weapi/yunbei/rcmd/song/history/list`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

@ -5,7 +5,7 @@ module.exports = async (query, request) => {
'POST',
`https://music.163.com/weapi/nos/token/alloc`,
{
bucket: '',
bucket: 'jd-musicrep-privatecloud-audio-public',
ext: 'mp3',
filename: query.songFile.name.replace('.mp3', ''),
local: false,
@ -21,7 +21,7 @@ module.exports = async (query, request) => {
try {
await axios({
method: 'post',
url: `http://45.127.129.8/ymusic/${objectKey}?offset=0&complete=true&version=1.0`,
url: `http://45.127.129.8/jd-musicrep-privatecloud-audio-public/${objectKey}?offset=0&complete=true&version=1.0`,
headers: {
'x-nos-token': tokenRes.body.result.token,
'Content-MD5': query.songFile.md5,
@ -29,9 +29,12 @@ module.exports = async (query, request) => {
'Content-Length': String(query.songFile.size),
},
data: query.songFile.data,
maxContentLength: Infinity,
maxBodyLength: Infinity,
})
} catch (error) {
console.log('error', error.response)
throw error.response
}
return {
...tokenRes,

@ -150,6 +150,9 @@ export function uploadSong(file) {
headers: {
'Content-Type': 'multipart/form-data',
},
timeout: 200000,
}).catch(error => {
alert(`上传失败Error: ${error}`);
});
}

Loading…
Cancel
Save