lx-music-desktop/src/renderer/utils/music/kw/api-wy.js
mrdong916 51c124201f 🔖 v1.6.1
2021-01-20 14:39:40 +08:00

21 lines
594 B
JavaScript

import { httpFetch } from '../../request'
import { requestMsg } from '../../message'
import { headers, timeout } from '../options'
const api_wy = {
getMusicUrl(songInfo, type) {
const requestObj = httpFetch(`https://api.sixyin.com/url/kw/${songInfo.songmid}/${type}`, {
method: 'get',
timeout,
headers,
family: 4,
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 0 ? Promise.resolve({ type, url: body.data }) : Promise.reject(new Error(requestMsg.fail))
})
return requestObj
},
}
export default api_wy