feat:移除部分音乐平台支持并优化现有功能
-移除了酷狗音乐、汽水音乐和小粉音乐的支持 - 优化了 Kuwo 和 QQ音乐的 API 调用,添加了 key 参数 -修复了删除歌曲时的错误处理,提高了程序的稳定性 - 更新了版本号至 4.3.0
This commit is contained in:
81
NFLmusic.py
81
NFLmusic.py
@ -143,7 +143,7 @@ def download_music(song_name, choose):
|
|||||||
progressbar.place(x=10, y=300)
|
progressbar.place(x=10, y=300)
|
||||||
br = br_dict[var.get()]
|
br = br_dict[var.get()]
|
||||||
if choice == "KUWO":
|
if choice == "KUWO":
|
||||||
resp = requests.get(f"{url}?msg={song_name}&n={choose}&br={br}&num=60&type=json")
|
resp = requests.get(f"{url}?msg={song_name}&n={choose}&br={br}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3")
|
||||||
resp.close()
|
resp.close()
|
||||||
id = resp.json()["link"].rsplit("/", 1)[1]
|
id = resp.json()["link"].rsplit("/", 1)[1]
|
||||||
try:
|
try:
|
||||||
@ -177,7 +177,7 @@ def download_music(song_name, choose):
|
|||||||
singer = resp.json()["singer"]
|
singer = resp.json()["singer"]
|
||||||
music_url = resp.json()["music_url"]
|
music_url = resp.json()["music_url"]
|
||||||
elif choice == "QQ":
|
elif choice == "QQ":
|
||||||
resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=60&type=json&br={br}")
|
resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=60&type=json&br={br}&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3")
|
||||||
resp.close()
|
resp.close()
|
||||||
try:
|
try:
|
||||||
lrc = resp.json()["data"]["lyric"]
|
lrc = resp.json()["data"]["lyric"]
|
||||||
@ -187,39 +187,6 @@ def download_music(song_name, choose):
|
|||||||
music_name = resp.json()["data"]["song_name"]
|
music_name = resp.json()["data"]["song_name"]
|
||||||
singer = resp.json()["data"]["song_singer"]
|
singer = resp.json()["data"]["song_singer"]
|
||||||
music_url = resp.json()["data"]["music_url"]
|
music_url = resp.json()["data"]["music_url"]
|
||||||
elif choice == "KUGOU":
|
|
||||||
resp = requests.get(f"{url}?gm={song_name}&n={choose}&num=60&type=json&quality={br}")
|
|
||||||
resp.close()
|
|
||||||
try:
|
|
||||||
lrc = resp.json()["lyrics"]
|
|
||||||
except Exception as e:
|
|
||||||
print(f"download_kugou_lrc: {e}")
|
|
||||||
lrc = ""
|
|
||||||
music_name = resp.json()["title"]
|
|
||||||
singer = resp.json()["singer"]
|
|
||||||
music_url = resp.json()["music_url"]
|
|
||||||
elif choice == "DOUYIN":
|
|
||||||
resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=50&type=json")
|
|
||||||
resp.close()
|
|
||||||
try:
|
|
||||||
lrc = resp.json()["data"]["lrc"]
|
|
||||||
except Exception as e:
|
|
||||||
print(f"download_qishui_lrc: {e}")
|
|
||||||
lrc = ""
|
|
||||||
music_name = resp.json()["data"]["title"]
|
|
||||||
singer = resp.json()["data"]["singer"]
|
|
||||||
music_url = resp.json()["data"]["url"]
|
|
||||||
elif choice == "XIAOFEN":
|
|
||||||
resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=60&type=json&br={br}")
|
|
||||||
resp.close()
|
|
||||||
try:
|
|
||||||
lrc = resp.json()["lrc"]
|
|
||||||
except Exception as e:
|
|
||||||
print(f"download_xiaofen_lrc: {e}")
|
|
||||||
lrc = ""
|
|
||||||
music_name = resp.json()["title"]
|
|
||||||
singer = resp.json()["singer"]
|
|
||||||
music_url = resp.json()["music_url"]
|
|
||||||
else:
|
else:
|
||||||
lrc = ""
|
lrc = ""
|
||||||
lrc = lrc.replace("\\n", "\n")
|
lrc = lrc.replace("\\n", "\n")
|
||||||
@ -327,17 +294,11 @@ def get_data_without_blocking(song_name):
|
|||||||
button0["state"] = "disabled"
|
button0["state"] = "disabled"
|
||||||
songlist.delete(*songlist.get_children())
|
songlist.delete(*songlist.get_children())
|
||||||
if choice == "KUWO":
|
if choice == "KUWO":
|
||||||
url1 = f"{url}?msg={song_name}&num=60&type=json"
|
url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
elif choice == "WANGYIYUN":
|
elif choice == "WANGYIYUN":
|
||||||
url1 = f"{url}?gm={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
url1 = f"{url}?gm={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
elif choice == "QQ":
|
elif choice == "QQ":
|
||||||
url1 = f"{url}?msg={song_name}&num=60&type=json"
|
url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
elif choice == "KUGOU":
|
|
||||||
url1 = f"{url}?gm={song_name}&num=60&type=json"
|
|
||||||
elif choice == "DOUYIN":
|
|
||||||
url1 = f"{url}?msg={song_name}&num=50&type=json"
|
|
||||||
elif choice == "XIAOFEN":
|
|
||||||
url1 = f"{url}?msg={song_name}&num=60&type=json"
|
|
||||||
resp = requests.get(url1)
|
resp = requests.get(url1)
|
||||||
jsondata = resp.json()["data"]
|
jsondata = resp.json()["data"]
|
||||||
resp.close()
|
resp.close()
|
||||||
@ -355,18 +316,6 @@ def get_data_without_blocking(song_name):
|
|||||||
full_name = jsondata[index]["song_title"]
|
full_name = jsondata[index]["song_title"]
|
||||||
artist = jsondata[index]["song_singer"]
|
artist = jsondata[index]["song_singer"]
|
||||||
album = ""
|
album = ""
|
||||||
elif choice == "KUGOU":
|
|
||||||
full_name = jsondata[index]["title"]
|
|
||||||
artist = jsondata[index]["singer"]
|
|
||||||
album = ""
|
|
||||||
elif choice == "DOUYIN":
|
|
||||||
full_name = jsondata[index]["title"]
|
|
||||||
artist = jsondata[index]["singer"]
|
|
||||||
album = ""
|
|
||||||
elif choice == "XIAOFEN":
|
|
||||||
full_name = jsondata[index]["title"]
|
|
||||||
artist = jsondata[index]["singer"]
|
|
||||||
album = ""
|
|
||||||
songlist.insert("", "end", values=(full_name, artist, album))
|
songlist.insert("", "end", values=(full_name, artist, album))
|
||||||
except requests.exceptions.JSONDecodeError:
|
except requests.exceptions.JSONDecodeError:
|
||||||
resp_text = resp.text
|
resp_text = resp.text
|
||||||
@ -437,19 +386,20 @@ def delete():
|
|||||||
tkinter.messagebox.showwarning(title=lang.get(la, "mbox.title.delete_fail"),
|
tkinter.messagebox.showwarning(title=lang.get(la, "mbox.title.delete_fail"),
|
||||||
message=lang.get(la, "mbox.text.delete_fail_no_target", ))
|
message=lang.get(la, "mbox.text.delete_fail_no_target", ))
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
try:
|
# try:
|
||||||
stopmusic()
|
stopmusic()
|
||||||
os.remove(abs_path)
|
os.remove(abs_path)
|
||||||
try:
|
try:
|
||||||
os.remove(abs_path_lrc)
|
os.remove(abs_path_lrc)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
music_dir_without_endswith.remove(filtered_list[listbox1.curselection()[0]])
|
music_dir_without_endswith.remove(listbox1.get(0, END)[listbox1.curselection()[0]])
|
||||||
music_dir.remove(music_dir[listbox1.curselection()[0]])
|
del music_dir[listbox1.curselection()[0]]
|
||||||
listbox1.delete(listbox1.curselection()[0])
|
listbox1.delete(listbox1.curselection()[0])
|
||||||
except:
|
# except Exception as e:
|
||||||
tkinter.messagebox.showerror(title=lang.get(la, "mbox.title.delete_fail"),
|
# print(e, type(e))
|
||||||
message=lang.get(la, "mbox.text.delete_fail_no_permission", ))
|
# tkinter.messagebox.showerror(title=lang.get(la, "mbox.title.delete_fail"),
|
||||||
|
# message=lang.get(la, "mbox.text.delete_fail_no_permission", ))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
tkinter.messagebox.showerror(title=lang.get(la, "mbox.title.delete_fail"),
|
tkinter.messagebox.showerror(title=lang.get(la, "mbox.title.delete_fail"),
|
||||||
message=lang.get(la, "mbox.text.delete_fail_not_found", ))
|
message=lang.get(la, "mbox.text.delete_fail_not_found", ))
|
||||||
@ -511,9 +461,7 @@ def playmusic(music_path):
|
|||||||
try:
|
try:
|
||||||
music_player.play_music(music_path)
|
music_player.play_music(music_path)
|
||||||
except pygame.error:
|
except pygame.error:
|
||||||
tkinter.messagebox.showerror(title=lang.get(la, "mbox.title.play_fail"),
|
os.startfile(music_path)
|
||||||
message=lang.get(la, "mbox.text.play_fail_unrecognized_format",
|
|
||||||
{"_file_": music_name}))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1331,7 +1279,7 @@ def search_local_song():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
version = "4.2.7"
|
version = "4.3.0"
|
||||||
poem = ""
|
poem = ""
|
||||||
appdata = os.getenv("APPDATA")
|
appdata = os.getenv("APPDATA")
|
||||||
make_resource()
|
make_resource()
|
||||||
@ -1695,9 +1643,6 @@ repo_dict = {
|
|||||||
"酷我音乐": "KUWO",
|
"酷我音乐": "KUWO",
|
||||||
"网易云音乐": "WANGYIYUN",
|
"网易云音乐": "WANGYIYUN",
|
||||||
"QQ音乐": "QQ",
|
"QQ音乐": "QQ",
|
||||||
"酷狗音乐": "KUGOU",
|
|
||||||
"汽水音乐": "DOUYIN",
|
|
||||||
"小粉音乐": "XIAOFEN"
|
|
||||||
}
|
}
|
||||||
repo_dict_reverse = {}
|
repo_dict_reverse = {}
|
||||||
for repo in repo_dict:
|
for repo in repo_dict:
|
||||||
|
Reference in New Issue
Block a user