qqmusic-api-python 0.1.8__tar.gz → 0.1.10__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.
Files changed (53) hide show
  1. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/PKG-INFO +6 -5
  2. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/README.md +2 -0
  3. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/pyproject.toml +1 -1
  4. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/__init__.py +8 -2
  5. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/album.py +16 -1
  6. qqmusic_api_python-0.1.10/qqmusic_api/data/api/login.json +196 -0
  7. qqmusic_api_python-0.1.10/qqmusic_api/login.py +426 -0
  8. qqmusic_api_python-0.1.10/qqmusic_api/login_utils.py +142 -0
  9. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/lyric.py +4 -3
  10. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/mv.py +4 -4
  11. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/network.py +30 -26
  12. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/qimei.py +4 -0
  13. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/sync.py +4 -2
  14. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/utils.py +3 -3
  15. qqmusic_api_python-0.1.10/tests/test_login.py +28 -0
  16. qqmusic_api_python-0.1.8/qqmusic_api/data/api/login.json +0 -70
  17. qqmusic_api_python-0.1.8/qqmusic_api/data/api-schema.json +0 -102
  18. qqmusic_api_python-0.1.8/qqmusic_api/login.py +0 -508
  19. qqmusic_api_python-0.1.8/tests/test_login.py +0 -30
  20. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/LICENSE +0 -0
  21. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/album.json +0 -0
  22. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/lyric.json +0 -0
  23. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/mv.json +0 -0
  24. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/search.json +0 -0
  25. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/singer.json +0 -0
  26. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/song.json +0 -0
  27. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/songlist.json +0 -0
  28. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/top.json +0 -0
  29. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/api/user.json +0 -0
  30. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/file_type.json +0 -0
  31. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/data/search_type.json +0 -0
  32. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/exceptions/__init__.py +0 -0
  33. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/exceptions/api_exception.py +0 -0
  34. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/search.py +0 -0
  35. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/singer.py +0 -0
  36. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/song.py +0 -0
  37. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/songlist.py +0 -0
  38. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/top.py +0 -0
  39. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/user.py +0 -0
  40. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/__init__.py +0 -0
  41. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/credential.py +0 -0
  42. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/qqmusic_api/utils/tripledes.py +0 -0
  43. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/conftest.py +0 -0
  44. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_album.py +0 -0
  45. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_lyric.py +0 -0
  46. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_mv.py +0 -0
  47. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_qimei.py +0 -0
  48. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_search.py +0 -0
  49. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_singer.py +0 -0
  50. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_song.py +0 -0
  51. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_songlist.py +0 -0
  52. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_top.py +0 -0
  53. {qqmusic_api_python-0.1.8 → qqmusic_api_python-0.1.10}/tests/test_user.py +0 -0
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qqmusic-api-python
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: QQ音乐API封装库
5
5
  Keywords: music,api,qqmusic,tencentmusic
6
- Home-page: https://github.com/luren-dc/QQMusicApi
7
6
  Author-Email: Luren <68656403+luren-dc@users.noreply.github.com>
8
7
  Maintainer-Email: Luren <68656403+luren-dc@users.noreply.github.com>
9
8
  License: MIT
@@ -17,9 +16,9 @@ Classifier: Programming Language :: Python :: 3 :: Only
17
16
  Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: Implementation :: CPython
19
18
  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
19
+ Project-URL: homepage, https://github.com/luren-dc/QQMusicApi
20
+ Project-URL: repository, https://github.com/luren-dc/QQMusicApi
21
+ Project-URL: documentation, https://github.com/luren-dc/QQMusicApi
23
22
  Requires-Python: <3.13,>=3.9
24
23
  Requires-Dist: cryptography<42.0.0,>=41.0.2
25
24
  Requires-Dist: typing-extensions>=4.12.2
@@ -53,6 +52,8 @@ Description-Content-Type: text/markdown
53
52
 
54
53
  > [!WARNING]
55
54
  > 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途
55
+ >
56
+ > All contents in this repo are for learning and reference only and are not allowed to be used for commercial purposes.
56
57
 
57
58
  **文档**: <a href="https://luren-dc.github.io/QQMusicApi" target="_blank">https://luren-dc.github.io/QQMusicApi</a>
58
59
 
@@ -25,6 +25,8 @@
25
25
 
26
26
  > [!WARNING]
27
27
  > 本仓库的所有内容仅供学习和参考之用,禁止用于商业用途
28
+ >
29
+ > All contents in this repo are for learning and reference only and are not allowed to be used for commercial purposes.
28
30
 
29
31
  **文档**: <a href="https://luren-dc.github.io/QQMusicApi" target="_blank">https://luren-dc.github.io/QQMusicApi</a>
30
32
 
@@ -39,7 +39,7 @@ classifiers = [
39
39
  "Topic :: Software Development :: Libraries :: Python Modules",
40
40
  ]
41
41
  dynamic = []
42
- version = "0.1.8"
42
+ version = "0.1.10"
43
43
 
44
44
  [project.license]
45
45
  text = "MIT"
@@ -1,15 +1,21 @@
1
- from . import album, login, lyric, mv, search, singer, song, songlist, top, user
1
+ import logging
2
+
3
+ from . import album, login, login_utils, lyric, mv, search, singer, song, songlist, top, user
2
4
  from .utils.credential import Credential
3
5
  from .utils.network import get_session, set_session
4
6
  from .utils.sync import sync
5
7
 
6
- __version__ = "0.1.8"
8
+ __version__ = "0.1.10"
9
+
10
+ logger = logging.getLogger("qqmusicapi")
11
+
7
12
 
8
13
  __all__ = [
9
14
  "album",
10
15
  "Credential",
11
16
  "get_session",
12
17
  "login",
18
+ "login_utils",
13
19
  "lyric",
14
20
  "mv",
15
21
  "search",
@@ -1,6 +1,6 @@
1
1
  """专辑相关 API"""
2
2
 
3
- from typing import Optional
3
+ from typing import Literal, Optional
4
4
 
5
5
  from .utils.network import Api
6
6
  from .utils.utils import get_api
@@ -8,6 +8,21 @@ from .utils.utils import get_api
8
8
  API = get_api("album")
9
9
 
10
10
 
11
+ def get_album_cover(mid: str, size: Literal[150, 300, 500, 800] = 300) -> str:
12
+ """获取专辑封面链接
13
+
14
+ Args:
15
+ mid: 专辑 mid
16
+ size: 封面大小
17
+
18
+ Returns:
19
+ 封面链接
20
+ """
21
+ if size not in [150, 300, 500, 800]:
22
+ raise ValueError("not supported size")
23
+ return f"https://y.gtimg.cn/music/photo_new/T002R{size}x{size}M000{mid}.jpg"
24
+
25
+
11
26
  class Album:
12
27
  """专辑类
13
28
 
@@ -0,0 +1,196 @@
1
+ {
2
+ "qq": {
3
+ "get_qrcode": {
4
+ "url": "https://ssl.ptlogin2.qq.com/ptqrshow",
5
+ "params": {
6
+ "appid": "716027609",
7
+ "e": "2",
8
+ "l": "M",
9
+ "s": "3",
10
+ "d": "72",
11
+ "v": "4",
12
+ "t": "str(random.random())",
13
+ "daid": "383",
14
+ "pt_3rd_aid": "100497308"
15
+ },
16
+ "headers": {
17
+ "Referer": "https://xui.ptlogin2.qq.com/"
18
+ },
19
+ "comment": "获取二维码二进制数据和 qrsig"
20
+ },
21
+ "check_qrcode_state": {
22
+ "url": "https://ssl.ptlogin2.qq.com/ptqrlogin",
23
+ "params": {
24
+ "u1": "https://graph.qq.com/oauth2.0/login_jump",
25
+ "ptqrtoken": "hash33(qrsig)",
26
+ "ptredirect": "0",
27
+ "h": "1",
28
+ "t": "1",
29
+ "g": "1",
30
+ "from_ui": "1",
31
+ "ptlang": "2052",
32
+ "action": "0-0-{time.time() * 1000}",
33
+ "js_ver": "20102616",
34
+ "js_type": "1",
35
+ "pt_uistyle": "40",
36
+ "aid": "716027609",
37
+ "daid": "383",
38
+ "pt_3rd_aid": "100497308",
39
+ "has_onekey": "1"
40
+ },
41
+ "headers": {
42
+ "Referer": "https://xui.ptlogin2.qq.com/"
43
+ },
44
+ "comment": "获取二维码状态"
45
+ },
46
+ "check_sig": {
47
+ "url": "https://ssl.ptlogin2.graph.qq.com/check_sig",
48
+ "ignore_code": true,
49
+ "params": {
50
+ "uin": "uin",
51
+ "pttype": "1",
52
+ "service": "ptqrlogin",
53
+ "nodirect": "0",
54
+ "ptsigx": "sigx",
55
+ "s_url": "https://graph.qq.com/oauth2.0/login_jump",
56
+ "ptlang": "2052",
57
+ "ptredirect": "100",
58
+ "aid": "716027609",
59
+ "daid": "383",
60
+ "j_later": "0",
61
+ "low_login_hour": "0",
62
+ "regmaster": "0",
63
+ "pt_login_type": "3",
64
+ "pt_aid": "0",
65
+ "pt_aaid": "16",
66
+ "pt_light": "0",
67
+ "pt_3rd_aid": "100497308"
68
+ },
69
+ "headers": {
70
+ "Referer": "https://xui.ptlogin2.qq.com/"
71
+ },
72
+ "comment": "获取 p_skey"
73
+ },
74
+ "authorize": {
75
+ "url": "https://graph.qq.com/oauth2.0/authorize",
76
+ "method": "POST",
77
+ "ignore_code": true,
78
+ "data": {
79
+ "response_type": "code",
80
+ "client_id": "100497308",
81
+ "redirect_uri": "https://y.qq.com/portal/wx_redirect.html?login_type=1&surl=https%3A%252F%252Fy.qq.com%252F",
82
+ "scope": "get_user_info,get_app_friends",
83
+ "state": "state",
84
+ "switch": "",
85
+ "from_ptlogin": "1",
86
+ "src": "1",
87
+ "update_auth": "1",
88
+ "openapi": "1010_1030",
89
+ "g_tk": "hash33(p_skey, 5381)",
90
+ "auth_time": "str(int(time.time()) * 1000)",
91
+ "ui": "str(uuid.uuid4())"
92
+ },
93
+ "comment": "QQ 鉴权"
94
+ },
95
+ "login": {
96
+ "module": "QQConnectLogin.LoginServer",
97
+ "method": "QQLogin",
98
+ "ignore_code": true,
99
+ "params": {
100
+ "code": "str 鉴权码",
101
+ "musicid": "int",
102
+ "musickey": "str",
103
+ "refresh_key": "str",
104
+ "refresh_token": "str"
105
+ },
106
+ "extra_common": {
107
+ "tmeLoginType": "str 2"
108
+ },
109
+ "comment": "QQ 登录"
110
+ }
111
+ },
112
+ "wx": {
113
+ "get_qrcode": {
114
+ "url": "https://open.weixin.qq.com/connect/qrconnect",
115
+ "params": {
116
+ "appid": "wx48db31d50e334801",
117
+ "redirect_uri": "https://y.qq.com/portal/wx_redirect.html?login_type=2&surl=https://y.qq.com/",
118
+ "response_type": "code",
119
+ "scope": "snsapi_login",
120
+ "state": "STATE",
121
+ "href": "https://y.qq.com/mediastyle/music_v17/src/css/popup_wechat.css#wechat_redirect"
122
+ },
123
+ "comment": "获取二维码二进制数据和 uuid"
124
+ },
125
+ "check_qrcode_state": {
126
+ "url": "https://lp.open.weixin.qq.com/connect/l/qrconnect",
127
+ "params": {
128
+ "uuid": "str uuid",
129
+ "_": "str 毫秒级时间戳"
130
+ },
131
+ "headers": {
132
+ "Referer": "https://open.weixin.qq.com/"
133
+ },
134
+ "comment": "获取二维码状态"
135
+ },
136
+ "login": {
137
+ "module": "music.login.LoginServer",
138
+ "method": "Login",
139
+ "ignore_code": true,
140
+ "params": {
141
+ "strAppid": "wx48db31d50e334801",
142
+ "code": "str 鉴权码",
143
+ "musicid": "int",
144
+ "musickey": "str",
145
+ "refresh_key": "str",
146
+ "refresh_token": "str",
147
+ "loginMode": "int 2"
148
+ },
149
+ "extra_common": {
150
+ "tmeLoginType": "str 1"
151
+ },
152
+ "comment": "微信登录"
153
+ }
154
+ },
155
+ "phone": {
156
+ "send_authcode": {
157
+ "module": "music.login.LoginServer",
158
+ "method": "SendPhoneAuthCode",
159
+ "ignore_code": true,
160
+ "params": {
161
+ "tmeAppid": "qqmusic",
162
+ "phoneNo": "str 手机号",
163
+ "encryptedPhoneNo ": "str 加密手机号",
164
+ "areaCode": "str 国家码(86)"
165
+ },
166
+ "extra_common": {
167
+ "tmeLoginMethod": "str 3"
168
+ },
169
+ "comment": "发送验证码"
170
+ },
171
+ "login": {
172
+ "module": "music.login.LoginServer",
173
+ "method": "Login",
174
+ "ignore_code": true,
175
+ "params": {
176
+ "code": "str 验证码",
177
+ "phoneNo": "str 手机号",
178
+ "encryptedPhoneNo ": "str 加密手机号",
179
+ "areaCode": "str 国家码(86)",
180
+ "loginMode": "int 1"
181
+ },
182
+ "extra_common": {
183
+ "tmeLoginMethod": "str 3",
184
+ "tmeLoginType": "str 0"
185
+ },
186
+ "comment": "手机验证码鉴权"
187
+ }
188
+ },
189
+ "check_expired": {
190
+ "module": "music.UserInfo.userInfoServer",
191
+ "method": "GetLoginUserInfo",
192
+ "verify": true,
193
+ "params": {},
194
+ "comment": "获取登录用户的信息,用于检测凭证是否失效"
195
+ }
196
+ }