修复 mg 图片、歌词获取

This commit is contained in:
lyswhut
2026-06-07 11:45:59 +08:00
parent cb2798cba9
commit 38c7bc0d0d
4 changed files with 7 additions and 26 deletions
+1
View File
@@ -8,3 +8,4 @@
- 修复 kg 搜索结果显示问题(#2782)
- 修复某些情况下开放 API 获取到的音量为 0 的问题(#2790)
- 修复 mg 图片、歌词获取
+1 -1
View File
@@ -75,7 +75,7 @@ const mrcTools = {
},
async getMusicInfo(songInfo) {
return songInfo.mrcUrl == null
? getMusicInfo(songInfo.copyrightId)
? getMusicInfo(songInfo.songmid)
: songInfo
},
getLyric(songInfo) {
+3 -23
View File
@@ -1,28 +1,8 @@
import { httpFetch } from '../../request'
import getSongId from './songId'
import { getMusicInfo } from './musicInfo'
export default {
async getPicUrl(songId, tryNum = 0) {
let requestObj = httpFetch(`http://music.migu.cn/v3/api/music/audioPlayer/getSongPic?songId=${songId}`, {
headers: {
Referer: 'http://music.migu.cn/v3/music/player/audio?from=migu',
},
})
requestObj.promise.then(({ body }) => {
if (body.returnCode !== '000000') {
if (tryNum > 5) return Promise.reject(new Error('图片获取失败'))
let tryRequestObj = this.getPic(songId, ++tryNum)
requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
return tryRequestObj.promise
}
let url = body.largePic || body.mediumPic || body.smallPic
if (!/https?:/.test(url)) url = 'http:' + url
return url
})
return requestObj
},
async getPic(songInfo) {
const songId = await getSongId(songInfo)
return this.getPicUrl(songId)
const info = await getMusicInfo(songInfo.songmid)
return info.img
},
}
+1 -1
View File
@@ -3,7 +3,7 @@ import { getMusicInfo } from './musicInfo'
const getSongId = async(mInfo) => {
if (mInfo.songmid != mInfo.copyrightId) return mInfo.songmid
const musicInfo = await getMusicInfo(mInfo.copyrightId)
const musicInfo = await getMusicInfo(mInfo.songmid)
return musicInfo.songmid
}