qqmusic-api-python 0.1.0__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.0/LICENSE +21 -0
- qqmusic_api_python-0.1.0/PKG-INFO +99 -0
- qqmusic_api_python-0.1.0/README.md +65 -0
- qqmusic_api_python-0.1.0/pyproject.toml +55 -0
- qqmusic_api_python-0.1.0/qqmusic_api/__init__.py +4 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/album.py +40 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/login.py +437 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/mv.py +115 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/search.py +168 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/song.py +389 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/songlist.py +81 -0
- qqmusic_api_python-0.1.0/qqmusic_api/api/top.py +98 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/album.json +20 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/login.json +69 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/mv.json +26 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/search.json +73 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/singer.json +1 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/song.json +105 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/songlist.json +17 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/api/top.json +20 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/file_type.json +50 -0
- qqmusic_api_python-0.1.0/qqmusic_api/data/search_type.json +11 -0
- qqmusic_api_python-0.1.0/qqmusic_api/exceptions.py +121 -0
- qqmusic_api_python-0.1.0/qqmusic_api/settings.py +22 -0
- qqmusic_api_python-0.1.0/qqmusic_api/utils/__init__.py +0 -0
- qqmusic_api_python-0.1.0/qqmusic_api/utils/common.py +140 -0
- qqmusic_api_python-0.1.0/qqmusic_api/utils/credential.py +92 -0
- qqmusic_api_python-0.1.0/qqmusic_api/utils/network.py +249 -0
- qqmusic_api_python-0.1.0/qqmusic_api/utils/qimei.py +267 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Luren
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: qqmusic-api-python
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: QQ音乐API封装库
|
|
5
|
+
Home-page: https://github.com/luren-dc/QQMusicApi
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: music,api,qqmusic,tencentmusic
|
|
8
|
+
Author: Luren
|
|
9
|
+
Author-email: dluren.c@gmail.com
|
|
10
|
+
Maintainer: Luren
|
|
11
|
+
Maintainer-email: dluren.c@gmail.com
|
|
12
|
+
Requires-Python: >=3.9,<4.0
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Framework :: Pytest
|
|
15
|
+
Classifier: Framework :: aiohttp
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Requires-Dist: aiohttp (==3.9.5)
|
|
28
|
+
Requires-Dist: cryptography (==41.0.2)
|
|
29
|
+
Requires-Dist: requests (==2.31.0)
|
|
30
|
+
Project-URL: Documentation, https://github.com/luren-dc/QQMusicApi
|
|
31
|
+
Project-URL: Repository, https://github.com/luren-dc/QQMusicApi
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
<div align="center">
|
|
35
|
+
<h1> QQMusicApi </h1>
|
|
36
|
+
<p> Python QQ音乐 API 封装库 </p>
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
[](https://github.com/astral-sh/ruff)
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
> [!WARNING]
|
|
47
|
+
> 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途。
|
|
48
|
+
|
|
49
|
+
## 介绍
|
|
50
|
+
|
|
51
|
+
使用 Python 编写的用于调用 [QQ音乐](https://y.qq.com/) 各种 API 的库.
|
|
52
|
+
|
|
53
|
+
## 依赖
|
|
54
|
+
|
|
55
|
+
本项目基于:
|
|
56
|
+
|
|
57
|
+
- [AIOHTTP](https://docs.aiohttp.org/)
|
|
58
|
+
- [Requests](https://requests.readthedocs.io/)
|
|
59
|
+
- [Cryptography](https://cryptography.io/)
|
|
60
|
+
|
|
61
|
+
## 快速上手
|
|
62
|
+
|
|
63
|
+
### 安装
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
$ pip3 install qqmusic-api-python
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 使用
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
import asyncio
|
|
73
|
+
|
|
74
|
+
from qqmusic_api import search
|
|
75
|
+
|
|
76
|
+
async def main():
|
|
77
|
+
# 搜索歌曲
|
|
78
|
+
result = await search.search_by_type(keyword="周杰伦", num=20)
|
|
79
|
+
# 打印结果
|
|
80
|
+
print(result)
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
asyncio.run(main())
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## TODO
|
|
87
|
+
|
|
88
|
+
- [ ] 歌手 API
|
|
89
|
+
|
|
90
|
+
## 参考项目
|
|
91
|
+
|
|
92
|
+
- [Rain120/qq-muisc-api](https://github.com/Rain120/qq-muisc-api)
|
|
93
|
+
- [jsososo/QQMusicApi](https://github.com/jsososo/QQMusicApi)
|
|
94
|
+
- [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api/)
|
|
95
|
+
|
|
96
|
+
## Licence
|
|
97
|
+
|
|
98
|
+
**[MIT License](https://github.com/luren-dc/QQMusicApi/blob/master/LICENSE)**
|
|
99
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1> QQMusicApi </h1>
|
|
3
|
+
<p> Python QQ音乐 API 封装库 </p>
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
[](https://github.com/astral-sh/ruff)
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> [!WARNING]
|
|
14
|
+
> 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途。
|
|
15
|
+
|
|
16
|
+
## 介绍
|
|
17
|
+
|
|
18
|
+
使用 Python 编写的用于调用 [QQ音乐](https://y.qq.com/) 各种 API 的库.
|
|
19
|
+
|
|
20
|
+
## 依赖
|
|
21
|
+
|
|
22
|
+
本项目基于:
|
|
23
|
+
|
|
24
|
+
- [AIOHTTP](https://docs.aiohttp.org/)
|
|
25
|
+
- [Requests](https://requests.readthedocs.io/)
|
|
26
|
+
- [Cryptography](https://cryptography.io/)
|
|
27
|
+
|
|
28
|
+
## 快速上手
|
|
29
|
+
|
|
30
|
+
### 安装
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
$ pip3 install qqmusic-api-python
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 使用
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
import asyncio
|
|
40
|
+
|
|
41
|
+
from qqmusic_api import search
|
|
42
|
+
|
|
43
|
+
async def main():
|
|
44
|
+
# 搜索歌曲
|
|
45
|
+
result = await search.search_by_type(keyword="周杰伦", num=20)
|
|
46
|
+
# 打印结果
|
|
47
|
+
print(result)
|
|
48
|
+
|
|
49
|
+
if __name__ == "__main__":
|
|
50
|
+
asyncio.run(main())
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## TODO
|
|
54
|
+
|
|
55
|
+
- [ ] 歌手 API
|
|
56
|
+
|
|
57
|
+
## 参考项目
|
|
58
|
+
|
|
59
|
+
- [Rain120/qq-muisc-api](https://github.com/Rain120/qq-muisc-api)
|
|
60
|
+
- [jsososo/QQMusicApi](https://github.com/jsososo/QQMusicApi)
|
|
61
|
+
- [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api/)
|
|
62
|
+
|
|
63
|
+
## Licence
|
|
64
|
+
|
|
65
|
+
**[MIT License](https://github.com/luren-dc/QQMusicApi/blob/master/LICENSE)**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "qqmusic-api-python"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "QQ音乐API封装库"
|
|
5
|
+
authors = ["Luren <dluren.c@gmail.com>"]
|
|
6
|
+
packages = [{ include = "qqmusic_api" }]
|
|
7
|
+
license = "MIT"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
maintainers = ["Luren <dluren.c@gmail.com>"]
|
|
10
|
+
homepage = "https://github.com/luren-dc/QQMusicApi"
|
|
11
|
+
repository = "https://github.com/luren-dc/QQMusicApi"
|
|
12
|
+
documentation = "https://github.com/luren-dc/QQMusicApi"
|
|
13
|
+
keywords = ["music", "api", "qqmusic", "tencentmusic"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Natural Language :: Chinese (Simplified)",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Framework :: Pytest",
|
|
19
|
+
"Framework :: aiohttp",
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.poetry.dependencies]
|
|
28
|
+
python = "^3.9"
|
|
29
|
+
cryptography = "41.0.2"
|
|
30
|
+
requests = "2.31.0"
|
|
31
|
+
aiohttp = "3.9.5"
|
|
32
|
+
|
|
33
|
+
[tool.poetry.group.dev.dependencies]
|
|
34
|
+
pytest = "8.2.0"
|
|
35
|
+
pytest-asyncio = "0.23.6"
|
|
36
|
+
qrcode = { extras = ["pil"], version = "7.4.2" }
|
|
37
|
+
pyzbar = "0.1.9"
|
|
38
|
+
pytest-timeout = "2.3.1"
|
|
39
|
+
pytest-sugar = "1.0.0"
|
|
40
|
+
pre-commit = "3.7.0"
|
|
41
|
+
|
|
42
|
+
[tool.mypy]
|
|
43
|
+
disable_error_code = ["index", "arg-type", "union-attr", "return-value"]
|
|
44
|
+
pretty = true
|
|
45
|
+
show_column_numbers = true
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
pythonpath = "./"
|
|
49
|
+
timeout = 30
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["poetry-core"]
|
|
55
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from qqmusic_api.api.song import Song
|
|
2
|
+
|
|
3
|
+
from ..utils.common import get_api
|
|
4
|
+
from ..utils.network import Api
|
|
5
|
+
|
|
6
|
+
API = get_api("album")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Album:
|
|
10
|
+
"""
|
|
11
|
+
专辑类
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, mid: str):
|
|
15
|
+
"""
|
|
16
|
+
Args:
|
|
17
|
+
mid: 专辑 mid
|
|
18
|
+
"""
|
|
19
|
+
self.mid = mid
|
|
20
|
+
|
|
21
|
+
async def get_detail(self) -> dict:
|
|
22
|
+
"""
|
|
23
|
+
Returns:
|
|
24
|
+
dict: 专辑详细信息
|
|
25
|
+
"""
|
|
26
|
+
return await Api(**API["detail"]).update_params(albumMid=self.mid).result
|
|
27
|
+
|
|
28
|
+
async def get_song(self) -> list[Song]:
|
|
29
|
+
"""
|
|
30
|
+
获取专辑歌曲
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
list: 歌曲列表
|
|
34
|
+
"""
|
|
35
|
+
result = (
|
|
36
|
+
await Api(**API["song"])
|
|
37
|
+
.update_params(albumMid=self.mid, begin=0, num=0)
|
|
38
|
+
.result
|
|
39
|
+
)
|
|
40
|
+
return [Song.from_dict(song["songInfo"]) for song in result["songList"]]
|