qqmusic-api-python 0.1.1__tar.gz → 0.1.4__tar.gz
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.
- qqmusic_api_python-0.1.4/PKG-INFO +110 -0
- qqmusic_api_python-0.1.4/README.md +81 -0
- qqmusic_api_python-0.1.4/pyproject.toml +148 -0
- qqmusic_api_python-0.1.4/qqmusic_api/__init__.py +19 -0
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/album.py +16 -16
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/ApiException.py +12 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/CredentialNoMusicidException.py +10 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/CredentialNoMusickeyException.py +10 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/CredentialNoRefreshkeyException.py +10 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/LoginException.py +10 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/ResponseCodeException.py +24 -0
- qqmusic_api_python-0.1.4/qqmusic_api/exceptions/__init__.py +15 -0
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/login.py +149 -121
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/mv.py +27 -24
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/search.py +22 -26
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/singer.py +37 -55
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/song.py +94 -122
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/songlist.py +19 -23
- {qqmusic_api_python-0.1.1/qqmusic_api/api → qqmusic_api_python-0.1.4/qqmusic_api}/top.py +37 -35
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/credential.py +33 -37
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/network.py +89 -70
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/qimei.py +155 -124
- qqmusic_api_python-0.1.4/qqmusic_api/utils/sync.py +32 -0
- qqmusic_api_python-0.1.1/qqmusic_api/utils/common.py → qqmusic_api_python-0.1.4/qqmusic_api/utils/utils.py +34 -44
- qqmusic_api_python-0.1.4/tests/__init__.py +3 -0
- qqmusic_api_python-0.1.4/tests/conftest.py +49 -0
- qqmusic_api_python-0.1.4/tests/test_album.py +11 -0
- qqmusic_api_python-0.1.4/tests/test_login.py +30 -0
- qqmusic_api_python-0.1.4/tests/test_mv.py +21 -0
- qqmusic_api_python-0.1.4/tests/test_search.py +31 -0
- qqmusic_api_python-0.1.4/tests/test_singer.py +35 -0
- qqmusic_api_python-0.1.4/tests/test_song.py +53 -0
- qqmusic_api_python-0.1.4/tests/test_songlist.py +15 -0
- qqmusic_api_python-0.1.4/tests/test_top.py +17 -0
- qqmusic_api_python-0.1.1/PKG-INFO +0 -103
- qqmusic_api_python-0.1.1/README.md +0 -69
- qqmusic_api_python-0.1.1/pyproject.toml +0 -54
- qqmusic_api_python-0.1.1/qqmusic_api/__init__.py +0 -14
- qqmusic_api_python-0.1.1/qqmusic_api/exceptions.py +0 -106
- qqmusic_api_python-0.1.1/qqmusic_api/settings.py +0 -22
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/LICENSE +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/album.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/login.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/mv.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/search.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/singer.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/song.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/songlist.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/top.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/file_type.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/data/search_type.json +0 -0
- {qqmusic_api_python-0.1.1 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/__init__.py +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: qqmusic-api-python
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: QQ音乐API封装库
|
|
5
|
+
Keywords: music,api,qqmusic,tencentmusic
|
|
6
|
+
Home-page: https://github.com/luren-dc/QQMusicApi
|
|
7
|
+
Author-Email: Luren <68656403+luren-dc@users.noreply.github.com>
|
|
8
|
+
Maintainer-Email: Luren <68656403+luren-dc@users.noreply.github.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Framework :: Pytest
|
|
14
|
+
Classifier: Framework :: aiohttp
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Project-URL: Homepage, https://github.com/luren-dc/QQMusicApi
|
|
21
|
+
Project-URL: Repository, https://github.com/luren-dc/QQMusicApi
|
|
22
|
+
Project-URL: Documentation, https://github.com/luren-dc/QQMusicApi
|
|
23
|
+
Requires-Python: <4.0,>=3.9
|
|
24
|
+
Requires-Dist: cryptography<42.0.0,>=41.0.2
|
|
25
|
+
Requires-Dist: requests<3.0.0,>=2.31.0
|
|
26
|
+
Requires-Dist: aiohttp<4.0.0,>=3.9.5
|
|
27
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<div align="center">
|
|
31
|
+
<h1> QQMusicApi </h1>
|
|
32
|
+
<p> Python QQ音乐 API 封装库 </p>
|
|
33
|
+
<a href="https://www.python.org">
|
|
34
|
+
<img src="https://img.shields.io/badge/python-3.9+-blue" alt="Python">
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
37
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
|
38
|
+
</a>
|
|
39
|
+
<a href="https://pdm-project.org">
|
|
40
|
+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json" alt="pdm-managed">
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://github.com/luren-dc/QQMusicApi/tree/build?tab=License-1-ov-file">
|
|
43
|
+
<img src="https://img.shields.io/github/license/luren-dc/PyQQMusicApi" alt="GitHub license">
|
|
44
|
+
</a>
|
|
45
|
+
<a href="https://github.com/luren-dc/QQMusicApi/stargazers">
|
|
46
|
+
<img src="https://img.shields.io/github/stars/luren-dc/QQMusicApi?color=yellow&label=Github%20Stars" alt="STARS">
|
|
47
|
+
</a>
|
|
48
|
+
<a href="https://github.com/luren-dc/QQMusicApi/actions/workflows/testing.yml">
|
|
49
|
+
<img src="https://github.com/luren-dc/QQMusicApi/actions/workflows/testing.yml/badge.svg?branch=dev" alt="Testing">
|
|
50
|
+
</a>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
> [!WARNING]
|
|
56
|
+
> 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途
|
|
57
|
+
|
|
58
|
+
**文档**: <a href="https://luren-dc.github.io/QQMusicApi" target="_blank">https://luren-dc.github.io/QQMusicApi</a>
|
|
59
|
+
|
|
60
|
+
**源代码**: <a href="https://github.com/luren-dc/QQMusicApi" target="_blank">https://github.com/luren-dc/QQMusicApi</a>
|
|
61
|
+
|
|
62
|
+
## 介绍
|
|
63
|
+
|
|
64
|
+
使用 Python 编写的用于调用 [QQ音乐](https://y.qq.com/) 各种 API 的库.
|
|
65
|
+
|
|
66
|
+
## 特色
|
|
67
|
+
|
|
68
|
+
- 涵盖常见 API
|
|
69
|
+
- 调用简便,函数命名易懂,代码注释详细
|
|
70
|
+
- 异步操作
|
|
71
|
+
|
|
72
|
+
## 依赖
|
|
73
|
+
|
|
74
|
+
- [AIOHTTP](https://docs.aiohttp.org/)
|
|
75
|
+
- [Requests](https://requests.readthedocs.io/)
|
|
76
|
+
- [Cryptography](https://cryptography.io/)
|
|
77
|
+
|
|
78
|
+
## 快速上手
|
|
79
|
+
|
|
80
|
+
### 安装
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install qqmusic-api-python
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 使用
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import asyncio
|
|
90
|
+
|
|
91
|
+
from qqmusic_api import search
|
|
92
|
+
|
|
93
|
+
async def main():
|
|
94
|
+
# 搜索歌曲
|
|
95
|
+
result = await search.search_by_type(keyword="周杰伦", num=20)
|
|
96
|
+
# 打印结果
|
|
97
|
+
print(result)
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 参考项目
|
|
103
|
+
|
|
104
|
+
- [Rain120/qq-muisc-api](https://github.com/Rain120/qq-music-api)
|
|
105
|
+
- [jsososo/QQMusicApi](https://github.com/jsososo/QQMusicApi)
|
|
106
|
+
- [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api/)
|
|
107
|
+
|
|
108
|
+
## Licence
|
|
109
|
+
|
|
110
|
+
**[MIT License](https://github.com/luren-dc/QQMusicApi?tab=MIT-1-ov-file)**
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1> QQMusicApi </h1>
|
|
3
|
+
<p> Python QQ音乐 API 封装库 </p>
|
|
4
|
+
<a href="https://www.python.org">
|
|
5
|
+
<img src="https://img.shields.io/badge/python-3.9+-blue" alt="Python">
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
8
|
+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://pdm-project.org">
|
|
11
|
+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json" alt="pdm-managed">
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/luren-dc/QQMusicApi/tree/build?tab=License-1-ov-file">
|
|
14
|
+
<img src="https://img.shields.io/github/license/luren-dc/PyQQMusicApi" alt="GitHub license">
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/luren-dc/QQMusicApi/stargazers">
|
|
17
|
+
<img src="https://img.shields.io/github/stars/luren-dc/QQMusicApi?color=yellow&label=Github%20Stars" alt="STARS">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://github.com/luren-dc/QQMusicApi/actions/workflows/testing.yml">
|
|
20
|
+
<img src="https://github.com/luren-dc/QQMusicApi/actions/workflows/testing.yml/badge.svg?branch=dev" alt="Testing">
|
|
21
|
+
</a>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
> [!WARNING]
|
|
27
|
+
> 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途
|
|
28
|
+
|
|
29
|
+
**文档**: <a href="https://luren-dc.github.io/QQMusicApi" target="_blank">https://luren-dc.github.io/QQMusicApi</a>
|
|
30
|
+
|
|
31
|
+
**源代码**: <a href="https://github.com/luren-dc/QQMusicApi" target="_blank">https://github.com/luren-dc/QQMusicApi</a>
|
|
32
|
+
|
|
33
|
+
## 介绍
|
|
34
|
+
|
|
35
|
+
使用 Python 编写的用于调用 [QQ音乐](https://y.qq.com/) 各种 API 的库.
|
|
36
|
+
|
|
37
|
+
## 特色
|
|
38
|
+
|
|
39
|
+
- 涵盖常见 API
|
|
40
|
+
- 调用简便,函数命名易懂,代码注释详细
|
|
41
|
+
- 异步操作
|
|
42
|
+
|
|
43
|
+
## 依赖
|
|
44
|
+
|
|
45
|
+
- [AIOHTTP](https://docs.aiohttp.org/)
|
|
46
|
+
- [Requests](https://requests.readthedocs.io/)
|
|
47
|
+
- [Cryptography](https://cryptography.io/)
|
|
48
|
+
|
|
49
|
+
## 快速上手
|
|
50
|
+
|
|
51
|
+
### 安装
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install qqmusic-api-python
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 使用
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import asyncio
|
|
61
|
+
|
|
62
|
+
from qqmusic_api import search
|
|
63
|
+
|
|
64
|
+
async def main():
|
|
65
|
+
# 搜索歌曲
|
|
66
|
+
result = await search.search_by_type(keyword="周杰伦", num=20)
|
|
67
|
+
# 打印结果
|
|
68
|
+
print(result)
|
|
69
|
+
|
|
70
|
+
asyncio.run(main())
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 参考项目
|
|
74
|
+
|
|
75
|
+
- [Rain120/qq-muisc-api](https://github.com/Rain120/qq-music-api)
|
|
76
|
+
- [jsososo/QQMusicApi](https://github.com/jsososo/QQMusicApi)
|
|
77
|
+
- [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api/)
|
|
78
|
+
|
|
79
|
+
## Licence
|
|
80
|
+
|
|
81
|
+
**[MIT License](https://github.com/luren-dc/QQMusicApi?tab=MIT-1-ov-file)**
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"pdm-backend",
|
|
4
|
+
]
|
|
5
|
+
build-backend = "pdm.backend"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "qqmusic-api-python"
|
|
9
|
+
description = "QQ音乐API封装库"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Luren", email = "68656403+luren-dc@users.noreply.github.com" },
|
|
12
|
+
]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"cryptography<42.0.0,>=41.0.2",
|
|
15
|
+
"requests<3.0.0,>=2.31.0",
|
|
16
|
+
"aiohttp<4.0.0,>=3.9.5",
|
|
17
|
+
"typing-extensions>=4.12.2",
|
|
18
|
+
]
|
|
19
|
+
requires-python = "<4.0,>=3.9"
|
|
20
|
+
readme = "README.md"
|
|
21
|
+
maintainers = [
|
|
22
|
+
{ name = "Luren", email = "68656403+luren-dc@users.noreply.github.com" },
|
|
23
|
+
]
|
|
24
|
+
keywords = [
|
|
25
|
+
"music",
|
|
26
|
+
"api",
|
|
27
|
+
"qqmusic",
|
|
28
|
+
"tencentmusic",
|
|
29
|
+
]
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Natural Language :: Chinese (Simplified)",
|
|
33
|
+
"License :: OSI Approved :: MIT License",
|
|
34
|
+
"Framework :: Pytest",
|
|
35
|
+
"Framework :: aiohttp",
|
|
36
|
+
"Programming Language :: Python",
|
|
37
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
40
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
41
|
+
]
|
|
42
|
+
dynamic = []
|
|
43
|
+
version = "0.1.4"
|
|
44
|
+
|
|
45
|
+
[project.license]
|
|
46
|
+
text = "MIT"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
homepage = "https://github.com/luren-dc/QQMusicApi"
|
|
50
|
+
repository = "https://github.com/luren-dc/QQMusicApi"
|
|
51
|
+
documentation = "https://github.com/luren-dc/QQMusicApi"
|
|
52
|
+
|
|
53
|
+
[tool.pdm]
|
|
54
|
+
distribution = true
|
|
55
|
+
|
|
56
|
+
[tool.pdm.version]
|
|
57
|
+
source = "file"
|
|
58
|
+
path = "qqmusic_api/__init__.py"
|
|
59
|
+
|
|
60
|
+
[tool.pdm.dev-dependencies]
|
|
61
|
+
testing = [
|
|
62
|
+
"pytest<9.0.0,>=8.2.0",
|
|
63
|
+
"pytest-asyncio<1.0.0,>=0.23.6",
|
|
64
|
+
"pytest-sugar<2.0.0,>=1.0.0",
|
|
65
|
+
]
|
|
66
|
+
docs = [
|
|
67
|
+
"mkdocs-material>=9.5.29",
|
|
68
|
+
"mkdocstrings-python>=1.10.5",
|
|
69
|
+
"mkdocstrings>=0.25.1",
|
|
70
|
+
"mkdocs>=1.6.0",
|
|
71
|
+
"markdown-callouts>=0.4.0",
|
|
72
|
+
"griffe-inherited-docstrings>=1.0.0",
|
|
73
|
+
]
|
|
74
|
+
mypy = [
|
|
75
|
+
"mypy>=1.11.0",
|
|
76
|
+
"types-requests>=2.32.0.20240712",
|
|
77
|
+
]
|
|
78
|
+
linting = [
|
|
79
|
+
"ruff>=0.5.4",
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
[tool.pdm.build]
|
|
83
|
+
source-includes = [
|
|
84
|
+
"qqmusic_api",
|
|
85
|
+
"README.md",
|
|
86
|
+
"LICENSE",
|
|
87
|
+
"tests",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.pdm.scripts]
|
|
91
|
+
docs = "mkdocs serve"
|
|
92
|
+
|
|
93
|
+
[tool.mypy]
|
|
94
|
+
pretty = true
|
|
95
|
+
python_version = 3.9
|
|
96
|
+
show_column_numbers = true
|
|
97
|
+
|
|
98
|
+
[tool.ruff]
|
|
99
|
+
line-length = 120
|
|
100
|
+
target-version = "py39"
|
|
101
|
+
|
|
102
|
+
[tool.ruff.format]
|
|
103
|
+
docstring-code-format = true
|
|
104
|
+
|
|
105
|
+
[tool.ruff.lint]
|
|
106
|
+
extend-select = [
|
|
107
|
+
"Q",
|
|
108
|
+
"RUF100",
|
|
109
|
+
"C90",
|
|
110
|
+
"UP",
|
|
111
|
+
"I",
|
|
112
|
+
"D",
|
|
113
|
+
"T",
|
|
114
|
+
]
|
|
115
|
+
extend-ignore = [
|
|
116
|
+
"D105",
|
|
117
|
+
"D107",
|
|
118
|
+
"D205",
|
|
119
|
+
"D415",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[tool.ruff.lint.pydocstyle]
|
|
123
|
+
convention = "google"
|
|
124
|
+
|
|
125
|
+
[tool.ruff.lint.per-file-ignores]
|
|
126
|
+
"docs/*" = [
|
|
127
|
+
"D",
|
|
128
|
+
]
|
|
129
|
+
"tests/*" = [
|
|
130
|
+
"D",
|
|
131
|
+
]
|
|
132
|
+
"qqmusic_api/__init__.py" = [
|
|
133
|
+
"F405",
|
|
134
|
+
"F403",
|
|
135
|
+
"D",
|
|
136
|
+
]
|
|
137
|
+
"qqmusic_api/**/__init__.py" = [
|
|
138
|
+
"F405",
|
|
139
|
+
"F403",
|
|
140
|
+
"D",
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
[tool.pytest.ini_options]
|
|
144
|
+
pythonpath = "./"
|
|
145
|
+
testpaths = [
|
|
146
|
+
"tests",
|
|
147
|
+
]
|
|
148
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from . import album, login, mv, search, singer, song, songlist, top
|
|
2
|
+
from .utils.credential import Credential
|
|
3
|
+
from .utils.network import get_aiohttp_session, set_aiohttp_session
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.4"
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"album",
|
|
9
|
+
"Credential",
|
|
10
|
+
"get_aiohttp_session",
|
|
11
|
+
"login",
|
|
12
|
+
"mv",
|
|
13
|
+
"search",
|
|
14
|
+
"set_aiohttp_session",
|
|
15
|
+
"singer",
|
|
16
|
+
"song",
|
|
17
|
+
"songlist",
|
|
18
|
+
"top",
|
|
19
|
+
]
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"""专辑相关 API"""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
3
|
+
from .song import Song
|
|
4
|
+
from .utils.network import Api
|
|
5
|
+
from .utils.utils import get_api
|
|
5
6
|
|
|
6
7
|
API = get_api("album")
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class Album:
|
|
10
|
-
"""
|
|
11
|
-
|
|
11
|
+
"""专辑类
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
mid: 专辑 mid
|
|
12
15
|
"""
|
|
13
16
|
|
|
14
17
|
def __init__(self, mid: str):
|
|
15
|
-
"""
|
|
18
|
+
"""初始化专辑类
|
|
19
|
+
|
|
16
20
|
Args:
|
|
17
21
|
mid: 专辑 mid
|
|
18
22
|
"""
|
|
@@ -22,22 +26,18 @@ class Album:
|
|
|
22
26
|
return f"Album(mid={self.mid})"
|
|
23
27
|
|
|
24
28
|
async def get_detail(self) -> dict:
|
|
25
|
-
"""
|
|
29
|
+
"""获取专辑详细信息
|
|
30
|
+
|
|
26
31
|
Returns:
|
|
27
|
-
|
|
32
|
+
专辑详细信息
|
|
28
33
|
"""
|
|
29
34
|
return await Api(**API["detail"]).update_params(albumMid=self.mid).result
|
|
30
35
|
|
|
31
36
|
async def get_song(self) -> list[Song]:
|
|
32
|
-
"""
|
|
33
|
-
获取专辑歌曲
|
|
37
|
+
"""获取专辑歌曲
|
|
34
38
|
|
|
35
39
|
Returns:
|
|
36
|
-
|
|
40
|
+
歌曲列表
|
|
37
41
|
"""
|
|
38
|
-
result = (
|
|
39
|
-
await Api(**API["song"])
|
|
40
|
-
.update_params(albumMid=self.mid, begin=0, num=0)
|
|
41
|
-
.result
|
|
42
|
-
)
|
|
42
|
+
result = await Api(**API["song"]).update_params(albumMid=self.mid, begin=0, num=0).result
|
|
43
43
|
return [Song.from_dict(song["songInfo"]) for song in result["songList"]]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""API 返回 code 错误"""
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from .ApiException import ApiException
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ResponseCodeException(ApiException):
|
|
9
|
+
"""API 返回 code 错误"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, code: int, msg: str, raw: Optional[dict] = None):
|
|
12
|
+
"""初始化错误类
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
code: 错误代码
|
|
16
|
+
msg: 错误信息
|
|
17
|
+
raw: 原始返回数据
|
|
18
|
+
"""
|
|
19
|
+
super().__init__(msg)
|
|
20
|
+
self.code = code
|
|
21
|
+
self.raw = raw
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return f"接口返回错误代码:{self.code},信息:{self.msg} \n{self.raw}"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .ApiException import ApiException
|
|
2
|
+
from .CredentialNoMusicidException import CredentialNoMusicidException
|
|
3
|
+
from .CredentialNoMusickeyException import CredentialNoMusickeyException
|
|
4
|
+
from .CredentialNoRefreshkeyException import CredentialNoRefreshkeyException
|
|
5
|
+
from .LoginException import LoginException
|
|
6
|
+
from .ResponseCodeException import ResponseCodeException
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"ApiException",
|
|
10
|
+
"CredentialNoMusicidException",
|
|
11
|
+
"CredentialNoMusickeyException",
|
|
12
|
+
"CredentialNoRefreshkeyException",
|
|
13
|
+
"LoginException",
|
|
14
|
+
"ResponseCodeException",
|
|
15
|
+
]
|