Download debug_mv_url.py from Zhepher/Netease: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/Zhepher/Netease/resolve/main/debug_mv_url.py
- Command line
-
hf download hf://spaces/Zhepher/Netease/debug_mv_url.py
-
curl -L -o debug_mv_url.py https://huggingface.co/spaces/Zhepher/Netease/resolve/main/debug_mv_url.py
1.07 kB
| """调试MV URL API响应""" | |
| import json | |
| from random import randrange | |
| from music_api import APIConstants, CryptoUtils, HTTPClient | |
| # 初始化工具 | |
| http_client = HTTPClient() | |
| crypto_utils = CryptoUtils() | |
| # MV URL API | |
| MV_URL_API = "https://interface3.music.163.com/eapi/song/enhance/play/mv/url" | |
| # 配置 | |
| config = APIConstants.DEFAULT_CONFIG.copy() | |
| config["requestId"] = str(randrange(20000000, 30000000)) | |
| # 测试MV ID | |
| mv_id = 5436712 | |
| quality = "720" | |
| payload = { | |
| 'id': mv_id, | |
| 'r': quality, | |
| 'header': json.dumps(config) | |
| } | |
| print(f"测试MV ID: {mv_id}, 画质: {quality}") | |
| print("="*50) | |
| try: | |
| params = crypto_utils.encrypt_params(MV_URL_API, payload) | |
| response_text = http_client.post_request(MV_URL_API, params, {}) | |
| print("原始响应:") | |
| print(response_text[:1000]) | |
| print("\n" + "="*50) | |
| result = json.loads(response_text) | |
| print("JSON解析结果:") | |
| print(json.dumps(result, indent=2, ensure_ascii=False)[:2000]) | |
| except Exception as e: | |
| print(f"错误: {e}") | |
| import traceback | |
| traceback.print_exc() | |