fix(KUWO): 修复酷我音乐下载链接和信息获取- 更新了酷我音乐 API 的请求 URL 和参数

- 修改了从响应中获取歌曲 ID、名称、歌手和 URL 的方法
- 优化了搜索结果的展示逻辑
- 增加了对酷我音乐 flac 音质的支持
This commit is contained in:
2025-04-30 22:38:43 +08:00
parent 0f81d3bddf
commit d6f030581b

View File

@ -143,9 +143,9 @@ def download_music(song_name, choose):
progressbar.place(x=10, y=300)
br = br_dict[var.get()]
if choice == "KUWO":
resp = requests.get(f"{url}/?msg={song_name}&n={choose}&br={br}&limit=60")
resp = requests.get(f"{url}?msg={song_name}&n={choose}&br={br}&num=60&type=json")
resp.close()
id = resp.json()["data"]["rid"].replace("MUSIC_", "")
id = resp.json()["link"].rsplit("/", 1)[1]
try:
resp_lrc = requests.get(f"http://m.kuwo.cn/newh5/singles/songinfoandlrc?musicId={id}")
resp_lrc.close()
@ -159,9 +159,9 @@ def download_music(song_name, choose):
except Exception as e:
print(f"download_kw_lrc: {e}")
lrc = ""
music_name = resp.json()["data"]["song"]
singer = resp.json()["data"]["singer"]
music_url = resp.json()["data"]["url"]
music_name = resp.json()["song_name"]
singer = resp.json()["song_singer"]
music_url = resp.json()["flac_url"]
elif choice == "WANGYIYUN":
resp = requests.get(f"{url}/?name={song_name}&n={choose}&br={br}&limit=60")
resp.close()
@ -277,7 +277,7 @@ def get_data_without_blocking(song_name):
button0["state"] = "disabled"
songlist.delete(*songlist.get_children())
if choice == "KUWO":
url1 = f"{url}/?msg={song_name}&limit=60"
url1 = f"{url}?msg={song_name}&num=60&type=json"
else:
url1 = f"{url}/?name={song_name}&limit=60"
resp = requests.get(url1)
@ -286,10 +286,10 @@ def get_data_without_blocking(song_name):
last_search_target = song_name
for index in range(len(jsondata)):
if choice == "KUWO":
full_name = jsondata[index]["song"]
full_name = jsondata[index]["songname"]
artist = jsondata[index]["singer"]
album = jsondata[index]["album"]
else:
album = jsondata[index]["song_rid"]
elif choice == "WANGYIYUN":
full_name = jsondata[index]["name"]
artist = jsondata[index]["singers"][0]["name"]
album = ""
@ -1238,7 +1238,7 @@ def search_local_song():
time.sleep(1)
version = "4.1.10"
version = "4.1.11"
poem = ""
appdata = os.getenv("APPDATA")
make_resource()