mirror of
https://github.com/2061360308/NeteaseCloudMusic_PythonSDK.git
synced 2024-11-21 14:38:19 +00:00
fix:fix package name error,compressed package volume
This commit is contained in:
parent
76f285a59e
commit
e0b8b68cfc
98
README.md
98
README.md
@ -1,98 +0,0 @@
|
||||
# NeteaseCloudMusic_PythonSDK
|
||||
> 基于 [ NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi) 封装的 Python SDK。
|
||||
>
|
||||
> 网易云API Python版本。
|
||||
>
|
||||
> 现已同步原项目接口且测试通过的有200多个
|
||||
>
|
||||
> 已发布到PyPi,可直接使用pip安装
|
||||
>
|
||||
> 项目地址:[GitHub](https://github.com/2061360308/NeteaseCloudMusic_PythonSDK)
|
||||
|
||||
![](https://img.shields.io/badge/py_mini_racer-@0.6.0-red.svg)
|
||||
![License](https://img.shields.io/badge/license-MIT-yellow)
|
||||
|
||||
### 依赖于
|
||||
- [ NeteaseCloudMusicApi](https://github.com/Binaryify/NeteaseCloudMusicApi)
|
||||
- [ NeteaseCloudMusicApi_V8 ](https://github.com/2061360308/NeteaseCloudMusicApi_V8)
|
||||
|
||||
### 原理
|
||||
- 通过 `py_mini_racer` 调用 `NeteaseCloudMusicApi_V8` 的 `js` 方法。进一步进行了简单封装。
|
||||
|
||||
### 使用
|
||||
- 安装 `pip install NeteaseCloudMusic`
|
||||
- 导入API进行使用(具体查看`test.py`中的示例)
|
||||
```python
|
||||
from NeteaseCloudMusic import NeteaseCloudMusicApi, api_help, api_list
|
||||
import os
|
||||
|
||||
netease_cloud_music_api = NeteaseCloudMusicApi() # 初始化API
|
||||
netease_cloud_music_api.cookie = os.getenv("COOKIE") # 设置cookie
|
||||
response = netease_cloud_music_api.request("song_url_v1", {"id": 33894312, "level": "exhigh"}) # 调用API
|
||||
|
||||
# 获取帮助
|
||||
print(api_help())
|
||||
print(api_help('song_url_v1'))
|
||||
# 获取API列表
|
||||
print(api_list())
|
||||
```
|
||||
|
||||
> 注意: request(self, name, query=None) 的第一个参数为API名称,第二个参数为API参数,具体API名称和参数请参考 [NeteaseCloudMusicApi文档](https://docs.neteasecloudmusicapi.binaryify.com),name支持`/song/url/v1`和`song_url_v1`两种写法。
|
||||
|
||||
|
||||
|
||||
![test_report.png](./docs/test_report.png)
|
||||
|
||||
|
||||
### 开发
|
||||
- 克隆项目 `git clone git@github.com:2061360308/NeteaseCloudMusic_PythonSDK.git`
|
||||
- 安装依赖 `pip install -r requirements.txt`
|
||||
- 目录/文件说明
|
||||
├── package 项目包根目录
|
||||
├── test_gender 生成测试代码的脚本
|
||||
├── test.py 手动测试/ 使用示例
|
||||
|
||||
|
||||
### 改进
|
||||
> 下列API未支持
|
||||
>
|
||||
- apicache.js
|
||||
- memory-cache.js
|
||||
- request_reference.js
|
||||
- avatar_upload.js
|
||||
- cloud.js
|
||||
- playlist_cover_update.js
|
||||
- voice_upload.js
|
||||
- register_anonimous.js
|
||||
- verify_getQr.js
|
||||
|
||||
> 以下api未测试(这些接口测试起来比较繁琐)
|
||||
>
|
||||
- /user/replacephone
|
||||
- /audio/match
|
||||
- /rebind
|
||||
- /nickname/check
|
||||
- /activate/init/profile
|
||||
- /cellphone/existence/check
|
||||
- /register/cellphone
|
||||
- /captcha/verify
|
||||
- /captcha/sent
|
||||
- /login/refresh
|
||||
- /logout
|
||||
- /user/update
|
||||
- /pl/count
|
||||
- /playlist/update
|
||||
- /playlist/desc/update
|
||||
- /playlist/name/update
|
||||
- /playlist/tags/update
|
||||
- /event/forward
|
||||
- /event/del
|
||||
- /share/resource
|
||||
- /send/text
|
||||
- /send/playlist
|
||||
- /playlist/create
|
||||
- /playlist/tracks
|
||||
- /daily_signin
|
||||
- /fm_trash
|
||||
|
||||
### 欢迎提交PR
|
307767
config.json
Normal file
307767
config.json
Normal file
File diff suppressed because one or more lines are too long
19
package/NeteaseCloudMusic.egg-info/PKG-INFO
Normal file
19
package/NeteaseCloudMusic.egg-info/PKG-INFO
Normal file
@ -0,0 +1,19 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: NeteaseCloudMusic
|
||||
Version: 0.1.3
|
||||
Summary: 网易云音乐API NeteaseCloudMusicApi项目的 Python SDK
|
||||
Home-page: https://github.com/2061360308/NeteaseCloudMusic_PythonSDK
|
||||
Author: 盧瞳
|
||||
Author-email: 2061360308@qq.com
|
||||
License: MIT
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Requires-Python: >=3.6.0
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
|
||||
网易云音乐API NeteaseCloudMusicApi项目的 Python SDK
|
13
package/NeteaseCloudMusic.egg-info/SOURCES.txt
Normal file
13
package/NeteaseCloudMusic.egg-info/SOURCES.txt
Normal file
@ -0,0 +1,13 @@
|
||||
LICENSE
|
||||
MANIFEST.in
|
||||
README.md
|
||||
setup.py
|
||||
NeteaseCloudMusic/__init__.py
|
||||
NeteaseCloudMusic/config.json
|
||||
NeteaseCloudMusic/help.py
|
||||
NeteaseCloudMusic/main.py
|
||||
NeteaseCloudMusic.egg-info/PKG-INFO
|
||||
NeteaseCloudMusic.egg-info/SOURCES.txt
|
||||
NeteaseCloudMusic.egg-info/dependency_links.txt
|
||||
NeteaseCloudMusic.egg-info/requires.txt
|
||||
NeteaseCloudMusic.egg-info/top_level.txt
|
1
package/NeteaseCloudMusic.egg-info/dependency_links.txt
Normal file
1
package/NeteaseCloudMusic.egg-info/dependency_links.txt
Normal file
@ -0,0 +1 @@
|
||||
|
2
package/NeteaseCloudMusic.egg-info/requires.txt
Normal file
2
package/NeteaseCloudMusic.egg-info/requires.txt
Normal file
@ -0,0 +1,2 @@
|
||||
py_mini_racer
|
||||
requests
|
1
package/NeteaseCloudMusic.egg-info/top_level.txt
Normal file
1
package/NeteaseCloudMusic.egg-info/top_level.txt
Normal file
@ -0,0 +1 @@
|
||||
NeteaseCloudMusic
|
File diff suppressed because one or more lines are too long
@ -4,6 +4,10 @@ import pkg_resources
|
||||
# 载入配置
|
||||
resource_path = pkg_resources.resource_filename(__name__, 'config.json')
|
||||
|
||||
# 不被支持的接口
|
||||
exclude = ["/request/reference", "/avatar/upload", "/cloud", "/playlist/cover/update", "/voice/upload",
|
||||
"/register/anonimous", "/verify/getQr"]
|
||||
|
||||
with open(resource_path, 'r', encoding='utf-8') as f:
|
||||
config = json.loads(f.read())
|
||||
|
||||
@ -39,4 +43,4 @@ def api_list():
|
||||
获取接口列表
|
||||
:return:
|
||||
"""
|
||||
return list(config.keys())
|
||||
return [item for item in list(config.keys()) if item not in exclude]
|
||||
|
@ -1,6 +1,6 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: NeteaseCloudMusicApi
|
||||
Version: 0.1.1
|
||||
Version: 0.1.2
|
||||
Summary: 网易云音乐API NeteaseCloudMusicApi项目的 Python SDK
|
||||
Home-page: https://github.com/me/myproject
|
||||
Author: Awesome Soul
|
||||
|
File diff suppressed because one or more lines are too long
@ -4,6 +4,10 @@ import pkg_resources
|
||||
# 载入配置
|
||||
resource_path = pkg_resources.resource_filename(__name__, 'config.json')
|
||||
|
||||
# 不被支持的接口
|
||||
exclude = ["/request/reference", "/avatar/upload", "/cloud", "/playlist/cover/update", "/voice/upload",
|
||||
"/register/anonimous", "/verify/getQr"]
|
||||
|
||||
with open(resource_path, 'r', encoding='utf-8') as f:
|
||||
config = json.loads(f.read())
|
||||
|
||||
@ -39,4 +43,4 @@ def api_list():
|
||||
获取接口列表
|
||||
:return:
|
||||
"""
|
||||
return list(config.keys())
|
||||
return [item for item in list(config.keys()) if item not in exclude]
|
||||
|
Binary file not shown.
BIN
package/dist/NeteaseCloudMusic-0.1.3.tar.gz
vendored
Normal file
BIN
package/dist/NeteaseCloudMusic-0.1.3.tar.gz
vendored
Normal file
Binary file not shown.
BIN
package/dist/NeteaseCloudMusicApi-0.1.0.tar.gz
vendored
BIN
package/dist/NeteaseCloudMusicApi-0.1.0.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
package/dist/NeteaseCloudMusicApi-0.1.1.tar.gz
vendored
BIN
package/dist/NeteaseCloudMusicApi-0.1.1.tar.gz
vendored
Binary file not shown.
@ -5,6 +5,7 @@
|
||||
# $ pipenv install twine --dev
|
||||
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from shutil import rmtree
|
||||
@ -12,13 +13,13 @@ from shutil import rmtree
|
||||
from setuptools import find_packages, setup, Command
|
||||
|
||||
# Package meta-data.
|
||||
NAME = 'NeteaseCloudMusicApi'
|
||||
NAME = 'NeteaseCloudMusic'
|
||||
DESCRIPTION = '网易云音乐API NeteaseCloudMusicApi项目的 Python SDK'
|
||||
URL = 'https://github.com/me/myproject'
|
||||
EMAIL = 'me@example.com'
|
||||
AUTHOR = 'Awesome Soul'
|
||||
URL = 'https://github.com/2061360308/NeteaseCloudMusic_PythonSDK'
|
||||
EMAIL = '2061360308@qq.com'
|
||||
AUTHOR = '盧瞳'
|
||||
REQUIRES_PYTHON = '>=3.6.0'
|
||||
VERSION = '0.1.1'
|
||||
VERSION = '0.1.3'
|
||||
|
||||
# What packages are required for this module to be executed?
|
||||
REQUIRED = [
|
||||
@ -41,13 +42,26 @@ here = os.path.abspath(os.path.dirname(__file__))
|
||||
# Import the README and use it as the long-description.
|
||||
# Note: this will only work if 'README.md' is present in your MANIFEST.in file!
|
||||
try:
|
||||
with io.open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||
with io.open(os.path.join(here, '../README.md'), encoding='utf-8') as f:
|
||||
long_description = '\n' + f.read()
|
||||
except FileNotFoundError:
|
||||
long_description = DESCRIPTION
|
||||
|
||||
# print("long_description:", long_description)
|
||||
|
||||
print("copy config.json start")
|
||||
with open(os.path.join(here, '../config.json'), 'r', encoding='utf-8') as f:
|
||||
config = json.loads(f.read())
|
||||
|
||||
for key in config:
|
||||
for example in config[key]['example']:
|
||||
if 'result' in example:
|
||||
del example['result']
|
||||
with open(os.path.join(here, 'NeteaseCloudMusic/config.json'), 'w+', encoding='utf-8') as f:
|
||||
f.write(json.dumps(config, indent=2, ensure_ascii=False))
|
||||
print("copy config.json end")
|
||||
|
||||
|
||||
# Load the package's __version__.py module as a dictionary.
|
||||
about = {}
|
||||
if not VERSION:
|
||||
|
23
test.py
23
test.py
@ -5,7 +5,9 @@ import os
|
||||
from pprint import pprint
|
||||
import dotenv
|
||||
|
||||
from NeteaseCloudMusic import NeteaseCloudMusicApi, api_help, api_list
|
||||
from package.NeteaseCloudMusic import NeteaseCloudMusicApi, api_help, api_list
|
||||
|
||||
# from NeteaseCloudMusic import NeteaseCloudMusicApi, api_help, api_list
|
||||
|
||||
dotenv.load_dotenv() # 从.env文件中加载环境变量
|
||||
|
||||
@ -14,7 +16,7 @@ netease_cloud_music_api.cookie = os.getenv("COOKIE") # 设置cookie
|
||||
netease_cloud_music_api.DEBUG = True # 开启调试模式
|
||||
|
||||
|
||||
def songv1_test():
|
||||
def song_url_v1_test():
|
||||
# 获取歌曲详情
|
||||
response = netease_cloud_music_api.request("song_url_v1", {"id": 33894312, "level": "exhigh"})
|
||||
pprint(response)
|
||||
@ -83,11 +85,22 @@ def login_cellphone_test():
|
||||
# pprint(response)
|
||||
|
||||
|
||||
def personalized_djprogram_test():
|
||||
response = netease_cloud_music_api.request("personalized_djprogram")
|
||||
pprint(response)
|
||||
|
||||
|
||||
def top_mv_test():
|
||||
response = netease_cloud_music_api.request("top_mv", {'limit': 6})
|
||||
pprint(response)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
print(api_list())
|
||||
print(api_help())
|
||||
# songv1_test()
|
||||
# print(api_list())
|
||||
# print(api_help())
|
||||
# song_url_v1_test()
|
||||
top_mv_test()
|
||||
# search_test()
|
||||
# search_default_test()
|
||||
# user_account_test()
|
||||
|
@ -18,13 +18,48 @@ def pathToName(path):
|
||||
|
||||
tests = ""
|
||||
|
||||
exclude = ["apicache.js", "memory-cache.js", "request_reference.js", "avatar_upload.js", "cloud.js",
|
||||
"playlist_cover_update.js", "voice_upload.js", "register_anonimous.js", "verify_getQr.js"]
|
||||
# 不被支持的接口
|
||||
exclude = ["/request/reference", "/avatar/upload", "/cloud", "/playlist/cover/update", "/voice/upload",
|
||||
"/register/anonimous", "/verify/getQr"]
|
||||
|
||||
# 忽略一些接口的测试
|
||||
ignore = ['/login/cellphone',
|
||||
'/user/replacephone',
|
||||
'/audio/match',
|
||||
'/rebind',
|
||||
'/nickname/check',
|
||||
'/activate/init/profile',
|
||||
'/cellphone/existence/check',
|
||||
'/register/cellphone',
|
||||
'/captcha/verify',
|
||||
'/captcha/sent',
|
||||
'/login/refresh',
|
||||
'/logout',
|
||||
'/user/update',
|
||||
'/avatar/upload',
|
||||
'/pl/count',
|
||||
'/playlist/update',
|
||||
'/playlist/desc/update',
|
||||
'/playlist/name/update',
|
||||
'/playlist/tags/update',
|
||||
'/playlist/cover/update',
|
||||
'/event/forward',
|
||||
'/event/del',
|
||||
'/share/resource',
|
||||
'/send/text',
|
||||
'/send/playlist',
|
||||
'/playlist/create',
|
||||
'/playlist/tracks',
|
||||
'/daily_signin',
|
||||
'/fm_trash']
|
||||
|
||||
for apiPath, value in config.items():
|
||||
apiName = pathToName(apiPath)
|
||||
|
||||
if (apiName+".js") in exclude:
|
||||
if (apiName + ".js") in exclude:
|
||||
continue
|
||||
|
||||
if apiPath in ignore:
|
||||
continue
|
||||
|
||||
apiExplain = value["explain"]
|
||||
|
Loading…
Reference in New Issue
Block a user