修复音乐下载失败的问题

This commit is contained in:
2025-03-16 14:21:07 +08:00
parent 12616f6b2e
commit 36e47bcb54

View File

@ -145,9 +145,9 @@ def download_music(song_name, choose):
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}&limit=60")
resp.close() resp.close()
id = resp.json()["data"]["rid"].replace("MUSIC_", "") id = resp.json()["data"]["rid"].replace("MUSIC_", "")
try:
resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=kw") resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=kw")
resp_lrc.close() resp_lrc.close()
try:
lrc = resp_lrc.json()["data"]["lrc"] lrc = resp_lrc.json()["data"]["lrc"]
except Exception as e: except Exception as e:
print(f"download_kw_lrc: {e}") print(f"download_kw_lrc: {e}")
@ -159,9 +159,9 @@ def download_music(song_name, choose):
resp = requests.get(f"{url}/?name={song_name}&n={choose}&br={br}&limit=60") resp = requests.get(f"{url}/?name={song_name}&n={choose}&br={br}&limit=60")
resp.close() resp.close()
id = resp.json()["data"]["id"] id = resp.json()["data"]["id"]
try:
resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=wy") resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=wy")
resp_lrc.close() resp_lrc.close()
try:
lrc = resp_lrc.json()["data"]["lrc"] lrc = resp_lrc.json()["data"]["lrc"]
except Exception as e: except Exception as e:
print(f"download_wyy_lrc: {e}") print(f"download_wyy_lrc: {e}")