From 919f1d5e878513646a5c5cbc3bce9168d0cdbf5c Mon Sep 17 00:00:00 2001 From: NFL_jiancx <1678594309@qq.com> Date: Tue, 11 Feb 2025 20:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NFLmusic.py | 30 +++++++++++++++++++----------- nflmusic/{ => assets}/test.py | 0 tools/test.py | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) rename nflmusic/{ => assets}/test.py (100%) diff --git a/NFLmusic.py b/NFLmusic.py index 54794fb..56db834 100644 --- a/NFLmusic.py +++ b/NFLmusic.py @@ -143,26 +143,34 @@ def download_music(song_name, choose): br = br_dict[var.get()] if choice == "KUWO": resp = requests.get(f"{url}/?msg={song_name}&n={choose}&br={br}&limit=60") - else: - resp = requests.get(f"{url}/?name={song_name}&n={choose}&br={br}&limit=60") - resp.close() - if url == "https://api.xingzhige.com/API/Kugou_GN_new": - resp_lrc = requests.get(f"https://oiapi.net/API/Kggc/?msg={song_name}&n={choose}&limit=60") + resp.close() + id = resp.json()["data"]["rid"].replace("MUSIC_", "") + resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=kw") resp_lrc.close() try: - lrc = resp_lrc.json()["data"]["content"] - except: + lrc = resp_lrc.json()["data"]["lrc"] + except Exception as e: + print(f"download_kw_lrc: {e}") lrc = "" - else: - lrc = "" - if choice == "KUWO": music_name = resp.json()["data"]["song"] singer = resp.json()["data"]["singer"] music_url = resp.json()["data"]["url"] - else: + elif choice == "WANGYIYUN": + resp = requests.get(f"{url}/?name={song_name}&n={choose}&br={br}&limit=60") + resp.close() + id = resp.json()["data"]["id"] + resp_lrc = requests.get(f"https://api.jkyai.top/API/yyjhss.php?id={id}&type=wy") + resp_lrc.close() + try: + lrc = resp_lrc.json()["data"]["lrc"] + except Exception as e: + print(f"download_wyy_lrc: {e}") + lrc = "" music_name = resp.json()["data"]["name"] singer = resp.json()["data"]["singers"][0]["name"] music_url = resp.json()["data"]["url"] + else: + lrc = "" response = requests.get(music_url, stream=True) formated = music_url.split("?")[0].rsplit(".", 1)[1] filename_without_endswith = f"{singer} - {music_name}" diff --git a/nflmusic/test.py b/nflmusic/assets/test.py similarity index 100% rename from nflmusic/test.py rename to nflmusic/assets/test.py diff --git a/tools/test.py b/tools/test.py index c6dcba0..70612b7 100644 --- a/tools/test.py +++ b/tools/test.py @@ -1 +1 @@ -"".rsplit() \ No newline at end of file +print("_wenren".split("_")) \ No newline at end of file