From 5afa005023bf77515f13cb1bfcd8968e28b9727f Mon Sep 17 00:00:00 2001 From: helloplhm-qwq Date: Sat, 11 Nov 2023 23:17:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dtx=E6=BA=90=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=AD=8C=E6=9B=B2404/=E9=9F=B3=E9=A2=91=E4=B8=8D?= =?UTF-8?q?=E7=AC=A6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/tx/__init__.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apis/tx/__init__.py b/apis/tx/__init__.py index b4be9a6..224b182 100644 --- a/apis/tx/__init__.py +++ b/apis/tx/__init__.py @@ -55,12 +55,32 @@ def signRequest(data): async def url(songId, quality): + infoReqBody = { + "comm": { + "ct": '19', + "cv": '1859', + "uin": '0', + }, + "req": { + "module": 'music.pf_song_detail_svr', + "method": 'get_song_detail_yqq', + "param": { + "song_type": 0, + "song_mid": songId, + }, + }, + } + infoRequest = signRequest(infoReqBody) + infoBody = jsobject(infoRequest.json()) + if (infoBody.code != 0 or infoBody.req.code != 0): + raise FailedException("获取音乐信息失败") + strMediaMid = infoBody.req.data.track_info.file.media_mid requestBody = { 'req_0': { 'module': 'vkey.GetVkeyServer', 'method': 'CgiGetVkey', 'param': { - 'filename': [f"{tools.fileInfo[quality]['h']}{songId}{tools.fileInfo[quality]['e']}"], + 'filename': [f"{tools.fileInfo[quality]['h']}{strMediaMid}{tools.fileInfo[quality]['e']}"], 'guid': tools.guid, 'songmid': [songId], 'songtype': [0],