From 5c46ca648d6924888245e44800f1fa8bf41f8bbe Mon Sep 17 00:00:00 2001 From: lyswhut Date: Mon, 18 May 2026 18:28:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B=20tx=20?= =?UTF-8?q?=E6=AD=8C=E5=8D=95=E6=89=93=E5=BC=80=E5=A4=B1=E8=B4=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 5 +- src/renderer/utils/musicSdk/tx/songList.js | 61 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) 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),