qqmusic-api-python 0.1.2__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.2 → qqmusic_api_python-0.1.4}/qqmusic_api/__init__.py +2 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/album.py +13 -8
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/ApiException.py +4 -3
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/CredentialNoMusicidException.py +4 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/CredentialNoMusickeyException.py +4 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/CredentialNoRefreshkeyException.py +4 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/LoginException.py +4 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/ResponseCodeException.py +5 -4
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/login.py +82 -51
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/mv.py +19 -14
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/search.py +15 -18
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/singer.py +26 -33
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/song.py +64 -80
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/songlist.py +16 -15
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/top.py +18 -14
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/credential.py +23 -28
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/network.py +19 -41
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/qimei.py +80 -6
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/sync.py +2 -4
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/utils/utils.py +16 -9
- 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.2/PKG-INFO +0 -112
- qqmusic_api_python-0.1.2/README.md +0 -78
- qqmusic_api_python-0.1.2/pyproject.toml +0 -68
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/LICENSE +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/album.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/login.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/mv.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/search.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/singer.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/song.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/songlist.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/api/top.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/file_type.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/data/search_type.json +0 -0
- {qqmusic_api_python-0.1.2 → qqmusic_api_python-0.1.4}/qqmusic_api/exceptions/__init__.py +0 -0
- {qqmusic_api_python-0.1.2 → 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"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""专辑相关 API"""
|
|
2
|
+
|
|
1
3
|
from .song import Song
|
|
2
4
|
from .utils.network import Api
|
|
3
5
|
from .utils.utils import get_api
|
|
@@ -6,12 +8,15 @@ API = get_api("album")
|
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
class Album:
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
+
"""专辑类
|
|
12
|
+
|
|
13
|
+
Attributes:
|
|
14
|
+
mid: 专辑 mid
|
|
11
15
|
"""
|
|
12
16
|
|
|
13
17
|
def __init__(self, mid: str):
|
|
14
|
-
"""
|
|
18
|
+
"""初始化专辑类
|
|
19
|
+
|
|
15
20
|
Args:
|
|
16
21
|
mid: 专辑 mid
|
|
17
22
|
"""
|
|
@@ -21,18 +26,18 @@ class Album:
|
|
|
21
26
|
return f"Album(mid={self.mid})"
|
|
22
27
|
|
|
23
28
|
async def get_detail(self) -> dict:
|
|
24
|
-
"""
|
|
29
|
+
"""获取专辑详细信息
|
|
30
|
+
|
|
25
31
|
Returns:
|
|
26
|
-
|
|
32
|
+
专辑详细信息
|
|
27
33
|
"""
|
|
28
34
|
return await Api(**API["detail"]).update_params(albumMid=self.mid).result
|
|
29
35
|
|
|
30
36
|
async def get_song(self) -> list[Song]:
|
|
31
|
-
"""
|
|
32
|
-
获取专辑歌曲
|
|
37
|
+
"""获取专辑歌曲
|
|
33
38
|
|
|
34
39
|
Returns:
|
|
35
|
-
|
|
40
|
+
歌曲列表
|
|
36
41
|
"""
|
|
37
42
|
result = await Api(**API["song"]).update_params(albumMid=self.mid, begin=0, num=0).result
|
|
38
43
|
return [Song.from_dict(song["songInfo"]) for song in result["songList"]]
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
"""API 返回 code 错误"""
|
|
2
|
+
|
|
1
3
|
from typing import Optional
|
|
2
4
|
|
|
3
5
|
from .ApiException import ApiException
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
class ResponseCodeException(ApiException):
|
|
7
|
-
"""
|
|
8
|
-
API 返回 code 错误。
|
|
9
|
-
"""
|
|
9
|
+
"""API 返回 code 错误"""
|
|
10
10
|
|
|
11
11
|
def __init__(self, code: int, msg: str, raw: Optional[dict] = None):
|
|
12
|
-
"""
|
|
12
|
+
"""初始化错误类
|
|
13
|
+
|
|
13
14
|
Args:
|
|
14
15
|
code: 错误代码
|
|
15
16
|
msg: 错误信息
|