ben-music-mcp 0.1.5__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ben-music-mcp might be problematic. Click here for more details.
- ben_music_mcp/__init__.py +1 -1
- ben_music_mcp/tool.py +6 -5
- {ben_music_mcp-0.1.5.dist-info → ben_music_mcp-0.1.6.dist-info}/METADATA +1 -1
- ben_music_mcp-0.1.6.dist-info/RECORD +10 -0
- ben_music_mcp-0.1.5.dist-info/RECORD +0 -10
- {ben_music_mcp-0.1.5.dist-info → ben_music_mcp-0.1.6.dist-info}/WHEEL +0 -0
- {ben_music_mcp-0.1.5.dist-info → ben_music_mcp-0.1.6.dist-info}/entry_points.txt +0 -0
ben_music_mcp/__init__.py
CHANGED
ben_music_mcp/tool.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import subprocess
|
|
3
2
|
import requests
|
|
4
3
|
|
|
@@ -10,15 +9,17 @@ import json
|
|
|
10
9
|
|
|
11
10
|
def _save_cookie_to_file(cookie: dict, filename: str = "cookie.txt"):
|
|
12
11
|
"""将cookie保存到文件"""
|
|
13
|
-
|
|
12
|
+
path = os.path.join(os.path.dirname(__file__), filename)
|
|
13
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
14
14
|
f.write(json.dumps(cookie, ensure_ascii=False))
|
|
15
15
|
|
|
16
16
|
def _load_cookie_from_file(filename: str = "cookie.txt") -> dict:
|
|
17
17
|
"""从文件读取cookie"""
|
|
18
|
-
|
|
18
|
+
path = os.path.join(os.path.dirname(__file__), filename)
|
|
19
|
+
if not os.path.exists(path):
|
|
19
20
|
return {}
|
|
20
21
|
try:
|
|
21
|
-
with open(
|
|
22
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
22
23
|
return json.loads(f.read())
|
|
23
24
|
except Exception:
|
|
24
25
|
return {}
|
|
@@ -112,7 +113,7 @@ def _search_artist(keyword: str) -> dict:
|
|
|
112
113
|
url = f"https://ncm.nekogan.com/ugc/artist/search?keyword={keyword}"
|
|
113
114
|
try:
|
|
114
115
|
cookie = _get_cookie()
|
|
115
|
-
resp = requests.get(url, timeout=
|
|
116
|
+
resp = requests.get(url, timeout=10, cookies=cookie)
|
|
116
117
|
resp.raise_for_status()
|
|
117
118
|
data = resp.json()
|
|
118
119
|
data_field = data.get("data")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ben_music_mcp/__init__.py,sha256=meKuPZULtLzFAOJz_2TvTus5wOr5cMXuqz-7vTpaNQg,5309
|
|
2
|
+
ben_music_mcp/cookie.txt,sha256=lT4cD7TKM02Ci8rtJFM1zcd_9RSzjv_4e26sfFY7ihk,1346
|
|
3
|
+
ben_music_mcp/server.py,sha256=80KVPLOFBC7faAxf-l_iGbmiXZKoomM__5eKAcnjJ_c,79
|
|
4
|
+
ben_music_mcp/styleList.json,sha256=dtODcFS6MFLvSOfP4x1VoAf5TYoE-nOwbhczGwus1X0,1079
|
|
5
|
+
ben_music_mcp/tool.py,sha256=sGNxC9o5HeE3L8PMSvVdvjgxLuTyYveVmzXLHsd4xHQ,19945
|
|
6
|
+
ben_music_mcp/toplist.json,sha256=HHNN_6LabK-lU5yoHq4RfJ1uDMOGgiKbCMksYVjNRQI,3423
|
|
7
|
+
ben_music_mcp-0.1.6.dist-info/entry_points.txt,sha256=Ii9fJl63ac3OgZb1AJkYvDST3hVZEA0nAujlhiqgpSA,52
|
|
8
|
+
ben_music_mcp-0.1.6.dist-info/METADATA,sha256=D3Q0ETOImj3U94F7JS0SvZCqgPgkIoeXmFW8v-2XlRU,2586
|
|
9
|
+
ben_music_mcp-0.1.6.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
10
|
+
ben_music_mcp-0.1.6.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
ben_music_mcp/__init__.py,sha256=l9rBZdXJcxQnhqDUar0rwjVOIiXOZHhQfH778VYH2LE,5309
|
|
2
|
-
ben_music_mcp/cookie.txt,sha256=lT4cD7TKM02Ci8rtJFM1zcd_9RSzjv_4e26sfFY7ihk,1346
|
|
3
|
-
ben_music_mcp/server.py,sha256=80KVPLOFBC7faAxf-l_iGbmiXZKoomM__5eKAcnjJ_c,79
|
|
4
|
-
ben_music_mcp/styleList.json,sha256=dtODcFS6MFLvSOfP4x1VoAf5TYoE-nOwbhczGwus1X0,1079
|
|
5
|
-
ben_music_mcp/tool.py,sha256=uRDWIisy6Hct9--NpAPxcIOqs5BcOFeeo8R04lqMZJg,19834
|
|
6
|
-
ben_music_mcp/toplist.json,sha256=HHNN_6LabK-lU5yoHq4RfJ1uDMOGgiKbCMksYVjNRQI,3423
|
|
7
|
-
ben_music_mcp-0.1.5.dist-info/entry_points.txt,sha256=Ii9fJl63ac3OgZb1AJkYvDST3hVZEA0nAujlhiqgpSA,52
|
|
8
|
-
ben_music_mcp-0.1.5.dist-info/METADATA,sha256=tPXF50w1jDAL_Nrm8cfcBD7ZQhfdFI0jUrzuwy32gU4,2586
|
|
9
|
-
ben_music_mcp-0.1.5.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
10
|
-
ben_music_mcp-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|