diff --git a/publish/changeLog.md b/publish/changeLog.md index 0938c13b..5025c257 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -6,6 +6,7 @@ ### 修复 -- 修复 kg 搜索结果显示问题(#2782) -- 修复某些情况下开放 API 获取到的音量为 0 的问题(#2790) +- 修复 kg 搜索结果显示问题 (#2782) +- 修复某些情况下开放 API 获取到的音量为 0 的问题 (#2790) - 修复 mg 图片、歌词获取 +- 修复某些 tx 歌单打开失败的问题 (#1060, @ght-000) diff --git a/src/renderer/utils/musicSdk/tx/songList.js b/src/renderer/utils/musicSdk/tx/songList.js index 356f694d..098f4344 100644 --- a/src/renderer/utils/musicSdk/tx/songList.js +++ b/src/renderer/utils/musicSdk/tx/songList.js @@ -193,6 +193,65 @@ export default { return id }, // 获取歌曲列表内的音乐 + async getListDetail2(id, tryNum = 0) { + if (tryNum > 2) return Promise.reject(new Error('try max num')) + + const requestObj_listDetail = httpFetch('https://u.y.qq.com/cgi-bin/musicu.fcg', { + method: 'post', + headers: { + Origin: 'https://y.qq.com', + Referer: `https://y.qq.com/n/yqq/playsquare/${id}.html`, + }, + body: { + comm: { + cv: 4747474, + ct: 24, + format: 'json', + inCharset: 'utf-8', + outCharset: 'utf-8', + platform: 'yqq.json', + needNewCode: 1, + uin: 0, + }, + req_1: { + module: 'music.srfDissInfo.aiDissInfo', + method: 'uniform_get_Dissinfo', + param: { + disstid: parseInt(id), + userinfo: 1, + tag: 1, + orderlist: 1, + song_begin: 0, + song_num: this.limit_song, + onlysonglist: 0, + enc_host_uin: '', + }, + }, + }, + }) + const { body } = await requestObj_listDetail.promise + // console.log(body) + if (body.code !== this.successCode) return this.getListDetail2(id, ++tryNum) + if (body.req_1.code !== this.successCode) throw new Error('failed') + + const result = body.req_1.data + const dirinfo = result.dirinfo + return { + list: this.filterListDetail(result.songlist), + page: 1, + limit: this.limit_song, + total: result.songnum, + source: 'tx', + info: { + name: dirinfo.title, + img: dirinfo.picurl, + desc: decodeName(dirinfo.desc ?? '').replace(/
/g, '\n'), + author: dirinfo.host_nick, + play_count: formatPlayCount(dirinfo.listennum), + }, + } + }, + // 获取歌曲列表内的音乐 async getListDetail(id, tryNum = 0) { if (tryNum > 2) return Promise.reject(new Error('try max num')) @@ -206,7 +265,9 @@ export default { }) const { body } = await requestObj_listDetail.promise + // console.log(body) if (body.code !== this.successCode) return this.getListDetail(id, ++tryNum) + if (body.subcode !== this.successCode || !body.cdlist) return this.getListDetail2(id) const cdlist = body.cdlist[0] return { list: this.filterListDetail(cdlist.songlist),