Spaces:
Building
Building
admin
commited on
Commit
·
e1bd545
1
Parent(s):
3e6dcd1
sync ms
Browse files- modules/kuwo.py +33 -34
- utils.py +9 -1
modules/kuwo.py
CHANGED
@@ -189,24 +189,15 @@ def infer2(url: str):
|
|
189 |
|
190 |
def kuwo_parser():
|
191 |
with gr.Blocks() as demo:
|
192 |
-
|
|
|
193 |
gr.Interface(
|
194 |
-
fn=
|
195 |
inputs=[
|
196 |
gr.Textbox(
|
197 |
label=_L("请输入酷我音乐 ID 或 URL 链接"),
|
198 |
placeholder="https://kuwo.cn/play_detail/*",
|
199 |
-
)
|
200 |
-
gr.Dropdown(
|
201 |
-
choices=[
|
202 |
-
_L("标准音质"),
|
203 |
-
_L("极高音质"),
|
204 |
-
_L("无损音质"),
|
205 |
-
_L("Hires音质"),
|
206 |
-
],
|
207 |
-
value=_L("无损音质"),
|
208 |
-
label=_L("音质"),
|
209 |
-
),
|
210 |
],
|
211 |
outputs=[
|
212 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
@@ -224,31 +215,34 @@ def kuwo_parser():
|
|
224 |
gr.Textbox(label=_L("音质"), show_copy_button=True),
|
225 |
gr.Textbox(label=_L("大小"), show_copy_button=True),
|
226 |
],
|
227 |
-
title=_L("酷我音乐无损解析"),
|
228 |
-
flagging_mode="never",
|
229 |
examples=[
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
_L("无损音质"),
|
235 |
-
],
|
236 |
-
[
|
237 |
-
"https://m.kuwo.cn/yinyue/237668532?f=ip&t=usercopy&prod_from=kwplayersimple",
|
238 |
-
_L("Hires音质"),
|
239 |
-
],
|
240 |
],
|
241 |
cache_examples=False,
|
|
|
242 |
)
|
243 |
|
244 |
-
with gr.Tab(_L("接口
|
245 |
gr.Interface(
|
246 |
-
fn=
|
247 |
inputs=[
|
248 |
gr.Textbox(
|
249 |
label=_L("请输入酷我音乐 ID 或 URL 链接"),
|
250 |
placeholder="https://kuwo.cn/play_detail/*",
|
251 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
],
|
253 |
outputs=[
|
254 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
@@ -266,15 +260,20 @@ def kuwo_parser():
|
|
266 |
gr.Textbox(label=_L("音质"), show_copy_button=True),
|
267 |
gr.Textbox(label=_L("大小"), show_copy_button=True),
|
268 |
],
|
269 |
-
title=_L("酷我音乐无损解析"),
|
270 |
-
flagging_mode="never",
|
271 |
examples=[
|
272 |
-
"237668532",
|
273 |
-
"https://kuwo.cn/play_detail/237668532",
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
],
|
277 |
cache_examples=False,
|
|
|
278 |
)
|
279 |
|
280 |
return demo
|
|
|
189 |
|
190 |
def kuwo_parser():
|
191 |
with gr.Blocks() as demo:
|
192 |
+
gr.Markdown(_L("## 酷我音乐无损解析"))
|
193 |
+
with gr.Tab(_L("接口2")):
|
194 |
gr.Interface(
|
195 |
+
fn=infer2,
|
196 |
inputs=[
|
197 |
gr.Textbox(
|
198 |
label=_L("请输入酷我音乐 ID 或 URL 链接"),
|
199 |
placeholder="https://kuwo.cn/play_detail/*",
|
200 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
],
|
202 |
outputs=[
|
203 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
|
|
215 |
gr.Textbox(label=_L("音质"), show_copy_button=True),
|
216 |
gr.Textbox(label=_L("大小"), show_copy_button=True),
|
217 |
],
|
|
|
|
|
218 |
examples=[
|
219 |
+
"237668532",
|
220 |
+
"https://kuwo.cn/play_detail/237668532",
|
221 |
+
"https://m.kuwo.cn/newh5app/play_detail/237668532",
|
222 |
+
"https://m.kuwo.cn/yinyue/237668532?f=ip&t=usercopy&prod_from=kwplayersimple",
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
],
|
224 |
cache_examples=False,
|
225 |
+
flagging_mode="never",
|
226 |
)
|
227 |
|
228 |
+
with gr.Tab(_L("接口1")):
|
229 |
gr.Interface(
|
230 |
+
fn=infer1,
|
231 |
inputs=[
|
232 |
gr.Textbox(
|
233 |
label=_L("请输入酷我音乐 ID 或 URL 链接"),
|
234 |
placeholder="https://kuwo.cn/play_detail/*",
|
235 |
+
),
|
236 |
+
gr.Dropdown(
|
237 |
+
choices=[
|
238 |
+
_L("标准音质"),
|
239 |
+
_L("极高音质"),
|
240 |
+
_L("无损音质"),
|
241 |
+
_L("Hires音质"),
|
242 |
+
],
|
243 |
+
value=_L("无损音质"),
|
244 |
+
label=_L("音质"),
|
245 |
+
),
|
246 |
],
|
247 |
outputs=[
|
248 |
gr.Textbox(label=_L("状态栏"), show_copy_button=True),
|
|
|
260 |
gr.Textbox(label=_L("音质"), show_copy_button=True),
|
261 |
gr.Textbox(label=_L("大小"), show_copy_button=True),
|
262 |
],
|
|
|
|
|
263 |
examples=[
|
264 |
+
["237668532", _L("标准音质")],
|
265 |
+
["https://kuwo.cn/play_detail/237668532", _L("极高音质")],
|
266 |
+
[
|
267 |
+
"https://m.kuwo.cn/newh5app/play_detail/237668532",
|
268 |
+
_L("无损音质"),
|
269 |
+
],
|
270 |
+
[
|
271 |
+
"https://m.kuwo.cn/yinyue/237668532?f=ip&t=usercopy&prod_from=kwplayersimple",
|
272 |
+
_L("Hires音质"),
|
273 |
+
],
|
274 |
],
|
275 |
cache_examples=False,
|
276 |
+
flagging_mode="never",
|
277 |
)
|
278 |
|
279 |
return demo
|
utils.py
CHANGED
@@ -18,7 +18,15 @@ KEY_KUWO_1 = os.getenv("apikey_kuwo_1")
|
|
18 |
API_QQ_2 = os.getenv("api_qmusic_2")
|
19 |
API_QQ_1 = os.getenv("api_qmusic_1")
|
20 |
KEY_QQ_1 = os.getenv("apikey_qmusic_1")
|
21 |
-
if not (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
print("请检查环境变量!")
|
23 |
exit()
|
24 |
|
|
|
18 |
API_QQ_2 = os.getenv("api_qmusic_2")
|
19 |
API_QQ_1 = os.getenv("api_qmusic_1")
|
20 |
KEY_QQ_1 = os.getenv("apikey_qmusic_1")
|
21 |
+
if not (
|
22 |
+
API_163
|
23 |
+
and API_KUWO_2
|
24 |
+
and API_KUWO_1
|
25 |
+
and KEY_KUWO_1
|
26 |
+
and API_QQ_2
|
27 |
+
and API_QQ_1
|
28 |
+
and KEY_QQ_1
|
29 |
+
):
|
30 |
print("请检查环境变量!")
|
31 |
exit()
|
32 |
|