feat(NFLmusic): 添加聚合搜索功能支持- 新增 JUHE 搜索选项,支持通过聚合接口获取音乐数据
- 调整歌词下载逻辑以适配新接口返回结构 - 修改歌曲列表展示逻辑,兼容不同平台的数据字段 - 更新版本号至4.3.3 - 在搜索菜单中增加“聚合搜索”入口并映射为 JUHE 标识
This commit is contained in:
43
NFLmusic.py
43
NFLmusic.py
@ -198,6 +198,18 @@ def download_music(song_name, choose):
|
|||||||
music_name = resp.json()["title"]
|
music_name = resp.json()["title"]
|
||||||
singer = resp.json()["singer"]
|
singer = resp.json()["singer"]
|
||||||
music_url = resp.json()["music_url"]
|
music_url = resp.json()["music_url"]
|
||||||
|
elif choice == "JUHE":
|
||||||
|
song_name = song_name.replace(" ", "")
|
||||||
|
resp = requests.get(f"{url}?msg={song_name}&n={choose}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3")
|
||||||
|
resp.close()
|
||||||
|
try:
|
||||||
|
lrc = resp.json()["data"]["lyric"]
|
||||||
|
except Exception as e:
|
||||||
|
print(f"download_kg_lrc: {e}")
|
||||||
|
lrc = ""
|
||||||
|
music_name = resp.json()["data"]["title"]
|
||||||
|
singer = resp.json()["data"]["singer"]
|
||||||
|
music_url = resp.json()["data"]["url"]
|
||||||
else:
|
else:
|
||||||
lrc = ""
|
lrc = ""
|
||||||
lrc = lrc.replace("\\n", "\n")
|
lrc = lrc.replace("\\n", "\n")
|
||||||
@ -312,27 +324,33 @@ def get_data_without_blocking(song_name):
|
|||||||
url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
url1 = f"{url}?msg={song_name}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
elif choice == "KUGOU":
|
elif choice == "KUGOU":
|
||||||
url1 = f"{url}?msg={song_name.replace(' ', '')}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
url1 = f"{url}?msg={song_name.replace(' ', '')}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
|
elif choice == "JUHE":
|
||||||
|
url1 = f"{url}?msg={song_name.replace(' ', '')}&num=60&type=json&key=Dragon5B887C2DC41AD03C93F06BAF4B7888C3"
|
||||||
resp = requests.get(url1)
|
resp = requests.get(url1)
|
||||||
jsondata = resp.json()["data"]
|
jsondata = resp.json()
|
||||||
resp.close()
|
resp.close()
|
||||||
last_search_target = song_name
|
last_search_target = song_name
|
||||||
for index in range(len(jsondata)):
|
for index in range(len(jsondata["data"])):
|
||||||
if choice == "KUWO":
|
if choice == "KUWO":
|
||||||
full_name = jsondata[index]["songname"]
|
full_name = jsondata["data"][index]["songname"]
|
||||||
artist = jsondata[index]["singer"]
|
artist = jsondata["data"][index]["singer"]
|
||||||
album = jsondata[index]["song_rid"]
|
album = jsondata["data"][index]["song_rid"]
|
||||||
elif choice == "WANGYIYUN":
|
elif choice == "WANGYIYUN":
|
||||||
full_name = jsondata[index]["title"]
|
full_name = jsondata["data"][index]["title"]
|
||||||
artist = jsondata[index]["singer"]
|
artist = jsondata["data"][index]["singer"]
|
||||||
album = jsondata[index]["songid"]
|
album = jsondata["data"][index]["songid"]
|
||||||
elif choice == "QQ":
|
elif choice == "QQ":
|
||||||
full_name = jsondata[index]["song_title"]
|
full_name = jsondata["data"][index]["song_title"]
|
||||||
artist = jsondata[index]["song_singer"]
|
artist = jsondata["data"][index]["song_singer"]
|
||||||
album = ""
|
album = ""
|
||||||
elif choice == "KUGOU":
|
elif choice == "KUGOU":
|
||||||
|
full_name = jsondata["data"][index]["title"]
|
||||||
|
artist = jsondata["data"][index]["singer"]
|
||||||
|
album = ""
|
||||||
|
elif choice == "JUHE":
|
||||||
full_name = jsondata[index]["title"]
|
full_name = jsondata[index]["title"]
|
||||||
artist = jsondata[index]["singer"]
|
artist = jsondata[index]["singer"]
|
||||||
album = ""
|
album = jsondata[index]["app"]
|
||||||
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
|
||||||
@ -1296,7 +1314,7 @@ def search_local_song():
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
version = "4.3.2"
|
version = "4.3.3"
|
||||||
poem = ""
|
poem = ""
|
||||||
appdata = os.getenv("APPDATA")
|
appdata = os.getenv("APPDATA")
|
||||||
make_resource()
|
make_resource()
|
||||||
@ -1661,6 +1679,7 @@ repo_dict = {
|
|||||||
"QQ音乐": "QQ",
|
"QQ音乐": "QQ",
|
||||||
"网易云音乐": "WANGYIYUN",
|
"网易云音乐": "WANGYIYUN",
|
||||||
"酷狗音乐": "KUGOU",
|
"酷狗音乐": "KUGOU",
|
||||||
|
"聚合搜索": "JUHE"
|
||||||
}
|
}
|
||||||
repo_dict_reverse = {}
|
repo_dict_reverse = {}
|
||||||
for repo in repo_dict:
|
for repo in repo_dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user