From aa5c31c257a504ad325bcda2216aa191a90a76fd Mon Sep 17 00:00:00 2001 From: NFL_jiancx <1678594309@qq.com> Date: Sat, 6 Sep 2025 21:30:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(NFLmusic):=20=E6=B7=BB=E5=8A=A0=E9=85=B7?= =?UTF-8?q?=E7=8B=97=E9=9F=B3=E4=B9=90=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增酷狗音乐的歌曲搜索和播放功能- 更新音乐搜索逻辑,支持酷狗音乐的接口 - 优化歌曲信息获取,包括歌名、歌手和歌词 - 版本升级到 4.3.2 --- NFLmusic.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/NFLmusic.py b/NFLmusic.py index 12f4cc4..7a8908e 100644 --- a/NFLmusic.py +++ b/NFLmusic.py @@ -91,7 +91,6 @@ def detect_change(): jsondata["theme"] != tmla.get(la)[var1.get()] or jsondata["path"] != var2.get() ): - changed = True @@ -187,6 +186,18 @@ def download_music(song_name, choose): music_name = resp.json()["data"]["song_name"] singer = resp.json()["data"]["song_singer"] music_url = resp.json()["data"]["music_url"] + elif choice == "KUGOU": + song_name = song_name.replace(" ", "") + resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=60&type=json&br={br}&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3") + resp.close() + try: + lrc = resp.json()["lyrics"] + except Exception as e: + print(f"download_kg_lrc: {e}") + lrc = "" + music_name = resp.json()["title"] + singer = resp.json()["singer"] + music_url = resp.json()["music_url"] else: lrc = "" lrc = lrc.replace("\\n", "\n") @@ -299,6 +310,8 @@ def get_data_without_blocking(song_name): url1 = f"{url}?gm={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3" elif choice == "QQ": url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3" + elif choice == "KUGOU": + url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3" resp = requests.get(url1) jsondata = resp.json()["data"] resp.close() @@ -316,6 +329,10 @@ def get_data_without_blocking(song_name): full_name = jsondata[index]["song_title"] artist = jsondata[index]["song_singer"] album = "" + elif choice == "KUGOU": + full_name = jsondata[index]["title"] + artist = jsondata[index]["singer"] + album = "" songlist.insert("", "end", values=(full_name, artist, album)) except requests.exceptions.JSONDecodeError: resp_text = resp.text @@ -1279,7 +1296,7 @@ def search_local_song(): time.sleep(1) -version = "4.3.1" +version = "4.3.2" poem = "" appdata = os.getenv("APPDATA") make_resource() @@ -1641,8 +1658,9 @@ themeLabel.place(x=10, y=25) # 基本设置 repo_dict = { "酷我音乐": "KUWO", - "网易云音乐": "WANGYIYUN", "QQ音乐": "QQ", + "网易云音乐": "WANGYIYUN", + "酷狗音乐": "KUGOU", } repo_dict_reverse = {} for repo in repo_dict: