lx-music-desktop/src/renderer/utils/musicSdk/mg/songId.js
Folltoshe d970687ebe
音源API更新 & 其他改动 (#1295)
## API

### kg源

- 增加歌单歌曲flac24bit显示
- 修复酷狗码只能导入500首的问题
- 更新排行榜

### mg源

- 修复搜索不显示时长的问题
- 修复评论加载失败的问题
- 更新排行榜

### tx源

- 增加热门评论图片显示
- 更新排行榜

### wy源

- 更新排行榜

## 其他

- 添加自定义源zlib模块的支持

---------

Co-authored-by: 彭狸花喵 <94218819+helloplhm-qwq@users.noreply.github.com>
Co-authored-by: lyswhut <lyswhut@qq.com>
2023-04-13 14:32:59 +08:00

32 lines
1.1 KiB
JavaScript

// import { httpFetch } from '../../request'
import { getMusicInfo } from './musicInfo'
const getSongId = async(mInfo) => {
if (mInfo.songmid != mInfo.copyrightId) return mInfo.songmid
const musicInfo = await getMusicInfo(mInfo.copyrightId)
return musicInfo.songmid
}
// export const getSongId = async(musicInfo, retry = 0) => {
// if (musicInfo.songmid != musicInfo.copyrightId) return musicInfo.songmid
// if (++retry > 2) return Promise.reject(new Error('max retry'))
// const requestObj = httpFetch(`https://app.c.nf.migu.cn/MIGUM2.0/v2.0/content/listen-url?netType=00&resourceType=2&songId=${musicInfo.copyrightId}&toneFlag=PQ`, {
// headers: {
// 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36',
// channel: '0146921',
// },
// })
// return requestObj.promise.then(({ body }) => {
// console.log(body)
// if (!body || body.code !== '000000') return this.getSongId(musicInfo, retry)
// const id = body.data.songItem.songId
// if (!id) throw new Error('failed')
// return id
// })
// }
export default getSongId