qqmusic-api-python 0.1.5__tar.gz → 0.1.7__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 (57) hide show
  1. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/PKG-INFO +5 -5
  2. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/README.md +3 -2
  3. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/pyproject.toml +6 -6
  4. qqmusic_api_python-0.1.7/qqmusic_api/__init__.py +22 -0
  5. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/album.py +27 -8
  6. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/login.json +9 -20
  7. qqmusic_api_python-0.1.7/qqmusic_api/data/api/lyric.json +25 -0
  8. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/search.json +9 -10
  9. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/song.json +13 -1
  10. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/file_type.json +4 -0
  11. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/login.py +86 -71
  12. qqmusic_api_python-0.1.7/qqmusic_api/lyric.py +68 -0
  13. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/mv.py +2 -5
  14. qqmusic_api_python-0.1.7/qqmusic_api/search.py +146 -0
  15. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/singer.py +27 -45
  16. qqmusic_api_python-0.1.7/qqmusic_api/song.py +346 -0
  17. qqmusic_api_python-0.1.7/qqmusic_api/songlist.py +56 -0
  18. qqmusic_api_python-0.1.7/qqmusic_api/top.py +52 -0
  19. qqmusic_api_python-0.1.7/qqmusic_api/utils/credential.py +131 -0
  20. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/utils/network.py +25 -28
  21. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/utils/qimei.py +3 -4
  22. qqmusic_api_python-0.1.7/qqmusic_api/utils/tripledes.py +1089 -0
  23. qqmusic_api_python-0.1.7/qqmusic_api/utils/utils.py +95 -0
  24. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/conftest.py +1 -1
  25. qqmusic_api_python-0.1.7/tests/test_qimei.py +5 -0
  26. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_singer.py +0 -7
  27. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_song.py +4 -7
  28. qqmusic_api_python-0.1.5/qqmusic_api/__init__.py +0 -19
  29. qqmusic_api_python-0.1.5/qqmusic_api/search.py +0 -164
  30. qqmusic_api_python-0.1.5/qqmusic_api/song.py +0 -415
  31. qqmusic_api_python-0.1.5/qqmusic_api/songlist.py +0 -85
  32. qqmusic_api_python-0.1.5/qqmusic_api/top.py +0 -105
  33. qqmusic_api_python-0.1.5/qqmusic_api/utils/credential.py +0 -89
  34. qqmusic_api_python-0.1.5/qqmusic_api/utils/utils.py +0 -130
  35. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/LICENSE +0 -0
  36. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/album.json +0 -0
  37. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/mv.json +0 -0
  38. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/singer.json +0 -0
  39. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/songlist.json +0 -0
  40. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/api/top.json +0 -0
  41. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/data/search_type.json +0 -0
  42. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/ApiException.py +0 -0
  43. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/CredentialNoMusicidException.py +0 -0
  44. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/CredentialNoMusickeyException.py +0 -0
  45. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/CredentialNoRefreshkeyException.py +0 -0
  46. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/LoginException.py +0 -0
  47. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/ResponseCodeException.py +0 -0
  48. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/exceptions/__init__.py +0 -0
  49. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/utils/__init__.py +0 -0
  50. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/qqmusic_api/utils/sync.py +0 -0
  51. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/__init__.py +0 -0
  52. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_album.py +0 -0
  53. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_login.py +0 -0
  54. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_mv.py +0 -0
  55. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_search.py +0 -0
  56. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_songlist.py +0 -0
  57. {qqmusic_api_python-0.1.5 → qqmusic_api_python-0.1.7}/tests/test_top.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qqmusic-api-python
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: QQ音乐API封装库
5
5
  Keywords: music,api,qqmusic,tencentmusic
6
6
  Home-page: https://github.com/luren-dc/QQMusicApi
@@ -22,9 +22,8 @@ Project-URL: Repository, https://github.com/luren-dc/QQMusicApi
22
22
  Project-URL: Documentation, https://github.com/luren-dc/QQMusicApi
23
23
  Requires-Python: <4.0,>=3.9
24
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
25
  Requires-Dist: typing-extensions>=4.12.2
26
+ Requires-Dist: httpx>=0.27.0
28
27
  Description-Content-Type: text/markdown
29
28
 
30
29
  <div align="center">
@@ -71,9 +70,10 @@ Description-Content-Type: text/markdown
71
70
 
72
71
  ## 依赖
73
72
 
74
- - [AIOHTTP](https://docs.aiohttp.org/)
75
- - [Requests](https://requests.readthedocs.io/)
73
+ - ~~[AIOHTTP](https://docs.aiohttp.org/)~~
74
+ - ~~[Requests](https://requests.readthedocs.io/)~~
76
75
  - [Cryptography](https://cryptography.io/)
76
+ - [HTTPX](https://github.com/encode/httpx/)
77
77
 
78
78
  ## 快速上手
79
79
 
@@ -42,9 +42,10 @@
42
42
 
43
43
  ## 依赖
44
44
 
45
- - [AIOHTTP](https://docs.aiohttp.org/)
46
- - [Requests](https://requests.readthedocs.io/)
45
+ - ~~[AIOHTTP](https://docs.aiohttp.org/)~~
46
+ - ~~[Requests](https://requests.readthedocs.io/)~~
47
47
  - [Cryptography](https://cryptography.io/)
48
+ - [HTTPX](https://github.com/encode/httpx/)
48
49
 
49
50
  ## 快速上手
50
51
 
@@ -12,9 +12,8 @@ authors = [
12
12
  ]
13
13
  dependencies = [
14
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
15
  "typing-extensions>=4.12.2",
16
+ "httpx>=0.27.0",
18
17
  ]
19
18
  requires-python = "<4.0,>=3.9"
20
19
  readme = "README.md"
@@ -40,7 +39,7 @@ classifiers = [
40
39
  "Topic :: Software Development :: Libraries :: Python Modules",
41
40
  ]
42
41
  dynamic = []
43
- version = "0.1.5"
42
+ version = "0.1.7"
44
43
 
45
44
  [project.license]
46
45
  text = "MIT"
@@ -73,7 +72,6 @@ docs = [
73
72
  ]
74
73
  mypy = [
75
74
  "mypy>=1.11.0",
76
- "types-requests>=2.32.0.20240712",
77
75
  ]
78
76
  linting = [
79
77
  "ruff>=0.5.4",
@@ -121,9 +119,11 @@ convention = "google"
121
119
  "tests/*" = [
122
120
  "D",
123
121
  ]
122
+ "examples/*" = [
123
+ "D",
124
+ "T",
125
+ ]
124
126
  "qqmusic_api/login.py" = [
125
- "F405",
126
- "F403",
127
127
  "D102",
128
128
  ]
129
129
  "qqmusic_api/__init__.py" = [
@@ -0,0 +1,22 @@
1
+ from . import album, login, lyric, mv, search, singer, song, songlist, top
2
+ from .utils.credential import Credential
3
+ from .utils.network import get_session, set_session
4
+ from .utils.sync import sync
5
+
6
+ __version__ = "0.1.7"
7
+
8
+ __all__ = [
9
+ "album",
10
+ "Credential",
11
+ "get_session",
12
+ "login",
13
+ "lyric",
14
+ "mv",
15
+ "search",
16
+ "set_session",
17
+ "singer",
18
+ "song",
19
+ "songlist",
20
+ "sync",
21
+ "top",
22
+ ]
@@ -2,7 +2,6 @@
2
2
 
3
3
  from typing import Optional
4
4
 
5
- from .song import Song
6
5
  from .utils.network import Api
7
6
  from .utils.utils import get_api
8
7
 
@@ -14,27 +13,45 @@ class Album:
14
13
 
15
14
  Attributes:
16
15
  mid: 专辑 mid
16
+ id: 专辑 id
17
17
  """
18
18
 
19
19
  def __init__(
20
20
  self,
21
+ *,
21
22
  mid: Optional[str] = None,
22
23
  id: Optional[int] = None,
23
24
  ):
24
25
  """初始化专辑类
25
26
 
27
+ Note:
28
+ 歌曲 mid 和 id,两者至少提供一个
29
+
26
30
  Args:
27
31
  mid: 专辑 mid
28
- id: 专辑 id
32
+ id: 专辑 id
29
33
  """
30
- # ID 检查
31
34
  if mid is None and id is None:
32
35
  raise ValueError("mid or id must be provided")
33
36
  self.mid = mid
34
37
  self.id = id
38
+ self._info: Optional[dict] = None
39
+
40
+ async def get_mid(self) -> str:
41
+ """获取专辑 mid
42
+
43
+ Returns:
44
+ 专辑 mid
45
+ """
46
+ return (await self.get_detail())["basicInfo"]["albumMid"]
47
+
48
+ async def get_id(self) -> int:
49
+ """获取专辑 id
35
50
 
36
- def __repr__(self) -> str:
37
- return f"Album(mid={self.mid}, id={self.id})"
51
+ Returns:
52
+ 专辑 id
53
+ """
54
+ return (await self.get_detail())["basicInfo"]["albumID"]
38
55
 
39
56
  async def get_detail(self) -> dict:
40
57
  """获取专辑详细信息
@@ -42,13 +59,15 @@ class Album:
42
59
  Returns:
43
60
  专辑详细信息
44
61
  """
45
- return await Api(**API["detail"]).update_params(albumMid=self.mid, albumId=self.id).result
62
+ if not self._info:
63
+ self._info = await Api(**API["detail"]).update_params(albumMid=self.mid, albumId=self.id).result
64
+ return self._info
46
65
 
47
- async def get_song(self) -> list[Song]:
66
+ async def get_song(self) -> list[dict]:
48
67
  """获取专辑歌曲
49
68
 
50
69
  Returns:
51
70
  歌曲列表
52
71
  """
53
72
  result = await Api(**API["song"]).update_params(albumMid=self.mid, albumId=self.id, begin=0, num=0).result
54
- return [Song.from_dict(song["songInfo"]) for song in result["songList"]]
73
+ return [song["songInfo"] for song in result["songList"]]
@@ -3,7 +3,10 @@
3
3
  "module": "QQConnectLogin.LoginServer",
4
4
  "method": "QQLogin",
5
5
  "params": {
6
- "code": "str 鉴权码"
6
+ "code": "str 鉴权码",
7
+ "musicid": "int",
8
+ "musickey": "str",
9
+ "refresh_key": "str"
7
10
  },
8
11
  "extra_common": {
9
12
  "tmeLoginType": "str 2"
@@ -15,7 +18,11 @@
15
18
  "method": "Login",
16
19
  "params": {
17
20
  "strAppid": "wx48db31d50e334801",
18
- "code": "str 鉴权码"
21
+ "code": "str 鉴权码",
22
+ "str_musicid": "str",
23
+ "musickey": "str",
24
+ "refresh_key": "str",
25
+ "loginMode": "int 2"
19
26
  },
20
27
  "extra_common": {
21
28
  "tmeLoginType": "str 1"
@@ -47,23 +54,5 @@
47
54
  "tmeLoginMethod": "str 3"
48
55
  },
49
56
  "comment": "发送验证码"
50
- },
51
- "refresh": {
52
- "module": "music.login.LoginServer",
53
- "method": "Login",
54
- "params": {
55
- "openid": "str",
56
- "access_token": "str",
57
- "refresh_token": "str",
58
- "expired_in": "int",
59
- "musicid": "str 必须",
60
- "musickey": "str",
61
- "refresh_key": "str 必须",
62
- "loginMode": "int 2"
63
- },
64
- "extra_common": {
65
- "tmeLoginMethod": "str 可填2"
66
- },
67
- "comment": "刷新cookies"
68
57
  }
69
58
  }
@@ -0,0 +1,25 @@
1
+ {
2
+ "info": {
3
+ "module": "music.musichallSong.PlayLyricInfo",
4
+ "method": "GetPlayLyricInfo",
5
+ "params": {
6
+ "ct": "int 11",
7
+ "cv": "int 13020508",
8
+ "lrc_t": "int 0",
9
+ "roma": "int 是否返回罗马歌词",
10
+ "roma_t": "int 0",
11
+ "trans": "int 是否返回翻译歌词",
12
+ "trans_t": "int 0",
13
+ "type": "int 1",
14
+ "albumName": "str 专辑名字",
15
+ "crypt": "int 是否加密歌词",
16
+ "qrc": "int 是否返回 qrc",
17
+ "qrc_t": "int 0",
18
+ "singerName": "str 歌手名字(取第一个)",
19
+ "songId": "int 歌曲 id",
20
+ "songMid": "str 歌曲 mid",
21
+ "songName": "str 歌曲名字"
22
+ },
23
+ "comment": "获取歌曲歌词信息"
24
+ }
25
+ }
@@ -11,10 +11,10 @@
11
11
  "module": "tencent_music_soso_smartbox_cgi.SmartBoxCgi",
12
12
  "method": "GetSmartBoxResult",
13
13
  "params": {
14
+ "search_id": "int 随机生成",
14
15
  "query": "str 搜索词",
15
16
  "num_per_page": "int 每页返回数量",
16
- "highlight": "int 是否高亮搜索词",
17
- "page_idx": "int 页数"
17
+ "page_idx": "int 1"
18
18
  },
19
19
  "comment": "获取搜索词补全"
20
20
  },
@@ -30,12 +30,13 @@
30
30
  "module": "music.adaptor.SearchAdaptor",
31
31
  "method": "do_search_v2",
32
32
  "params": {
33
- "search_id": "int 随机生成",
33
+ "searchid": "int 随机生成",
34
34
  "search_type": "int 100",
35
35
  "query": "str 搜索词",
36
- "highlight": "int 是否高亮搜索词",
37
36
  "grp": "int 是否返回歌曲其他版本",
38
- "page_id": "int 页数"
37
+ "highlight": "int 是否高亮搜索词",
38
+ "page_id": "int 页数",
39
+ "page_num": "int 15"
39
40
  },
40
41
  "comment": "综合搜索"
41
42
  },
@@ -46,10 +47,9 @@
46
47
  "search_id": "int 随机生成",
47
48
  "search_type": "int 搜索类型",
48
49
  "query": "str 搜索词",
49
- "highlight": "int 是否高亮搜索词",
50
- "page_id": "int 页数",
51
50
  "page_num": "int 页数",
52
51
  "num_per_page": "int 每页返回数量",
52
+ "highlight": "int 是否高亮搜索词",
53
53
  "selectors": "dict 选择器"
54
54
  },
55
55
  "comment": "桌面端搜索"
@@ -58,13 +58,12 @@
58
58
  "module": "music.search.SearchCgiService",
59
59
  "method": "DoSearchForQQMusicMobile",
60
60
  "params": {
61
- "search_id": "int 随机生成",
61
+ "searchid": "int 随机生成",
62
62
  "search_type": "int 搜索类型",
63
63
  "query": "str 搜索词",
64
- "highlight": "int 是否高亮搜索词",
65
- "page_id": "int 页数",
66
64
  "page_num": "int 页数",
67
65
  "grp": "int 是否返回歌曲其他版本",
66
+ "highlight": "int 是否高亮搜索词",
68
67
  "num_per_page": "int 每页返回数量",
69
68
  "selectors": "dict 选择器"
70
69
  },
@@ -50,7 +50,8 @@
50
50
  "method": "GetSongRelatedMv",
51
51
  "params": {
52
52
  "songid": "int 歌曲 ID",
53
- "songmid": "str 歌曲 mid"
53
+ "songtype": "int 1",
54
+ "lastmvid": "用于刷新列表"
54
55
  },
55
56
  "comment": "获取相关MV"
56
57
  },
@@ -80,6 +81,17 @@
80
81
  },
81
82
  "comment": "获取歌曲制作团队"
82
83
  },
84
+ "evkey": {
85
+ "module": "music.vkey.GetEVkey",
86
+ "method": "CgiGetEVkey",
87
+ "params": {
88
+ "filename": "[f'{file_type.s}{_}{_}{file_type.e}' for _ in mid]",
89
+ "guid": "str 随机32位字符串",
90
+ "songmid": "list mid 列表",
91
+ "songtype": "[1 for _ in range(len(mid))]"
92
+ },
93
+ "comment": "获取加密文件链接"
94
+ },
83
95
  "play_url": {
84
96
  "module": "music.vkey.GetVkey",
85
97
  "method": "UrlGetVkey",
@@ -15,6 +15,10 @@
15
15
  "s": "F000",
16
16
  "e": ".flac"
17
17
  },
18
+ "ogg_320": {
19
+ "s": "O800",
20
+ "e": ".ogg"
21
+ },
18
22
  "ogg_192": {
19
23
  "s": "O600",
20
24
  "e": ".ogg"