mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 14:41:23 +08:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
// 云盘导入歌曲
|
|
const createOption = require('../util/option.js')
|
|
module.exports = async (query, request) => {
|
|
query.id = query.id || -2
|
|
query.artist = query.artist || '未知'
|
|
query.album = query.album || '未知'
|
|
const checkData = {
|
|
uploadType: 0,
|
|
songs: JSON.stringify([
|
|
{
|
|
md5: query.md5,
|
|
songId: query.id,
|
|
bitrate: query.bitrate,
|
|
fileSize: query.fileSize,
|
|
},
|
|
]),
|
|
}
|
|
const res = await request(
|
|
'POST',
|
|
`/api/cloud/upload/check/v2`,
|
|
checkData,
|
|
createOption(query),
|
|
)
|
|
//res.body.data[0].upload 0:文件可导入,1:文件已在云盘,2:不能导入
|
|
//只能用song决定云盘文件名,且上传后的文件名后缀固定为mp3
|
|
const importData = {
|
|
uploadType: 0,
|
|
songs: JSON.stringify([
|
|
{
|
|
songId: res.body.data[0].songId,
|
|
bitrate: query.bitrate,
|
|
song: query.song,
|
|
artist: query.artist,
|
|
album: query.album,
|
|
fileName: query.song + '.' + query.fileType,
|
|
},
|
|
]),
|
|
}
|
|
return request(
|
|
'POST',
|
|
`/api/cloud/user/song/import`,
|
|
importData,
|
|
createOption(query),
|
|
)
|
|
}
|