tikdataapi 0.1.0__py3-none-any.whl

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 (103) hide show
  1. tikdataapi/__init__.py +8 -0
  2. tikdataapi/api/__init__.py +1 -0
  3. tikdataapi/api/account/__init__.py +1 -0
  4. tikdataapi/api/account/get_me.py +144 -0
  5. tikdataapi/api/billing/__init__.py +1 -0
  6. tikdataapi/api/billing/create_checkout.py +215 -0
  7. tikdataapi/api/billing/list_packs.py +144 -0
  8. tikdataapi/api/hashtags/__init__.py +1 -0
  9. tikdataapi/api/hashtags/get_hashtag.py +220 -0
  10. tikdataapi/api/hashtags/get_hashtag_videos.py +250 -0
  11. tikdataapi/api/music/__init__.py +1 -0
  12. tikdataapi/api/music/get_music.py +234 -0
  13. tikdataapi/api/music/get_music_videos.py +254 -0
  14. tikdataapi/api/playlists/__init__.py +1 -0
  15. tikdataapi/api/playlists/get_playlist_videos.py +258 -0
  16. tikdataapi/api/search/__init__.py +1 -0
  17. tikdataapi/api/search/search_hashtags.py +261 -0
  18. tikdataapi/api/search/search_live.py +258 -0
  19. tikdataapi/api/search/search_music.py +260 -0
  20. tikdataapi/api/search/search_users.py +276 -0
  21. tikdataapi/api/search/search_videos.py +260 -0
  22. tikdataapi/api/users/__init__.py +1 -0
  23. tikdataapi/api/users/get_user.py +222 -0
  24. tikdataapi/api/users/get_user_followers.py +266 -0
  25. tikdataapi/api/users/get_user_following.py +266 -0
  26. tikdataapi/api/users/get_user_live.py +236 -0
  27. tikdataapi/api/users/get_user_playlists.py +276 -0
  28. tikdataapi/api/users/get_user_reposts.py +266 -0
  29. tikdataapi/api/users/get_user_videos.py +254 -0
  30. tikdataapi/api/users/get_users.py +247 -0
  31. tikdataapi/api/users/get_users_videos.py +259 -0
  32. tikdataapi/api/videos/__init__.py +1 -0
  33. tikdataapi/api/videos/get_comment_replies.py +260 -0
  34. tikdataapi/api/videos/get_comments.py +258 -0
  35. tikdataapi/api/videos/get_related_videos.py +247 -0
  36. tikdataapi/api/videos/get_trending_videos.py +238 -0
  37. tikdataapi/api/videos/get_video.py +218 -0
  38. tikdataapi/api/videos/get_video_transcript.py +247 -0
  39. tikdataapi/api/videos/get_videos.py +235 -0
  40. tikdataapi/client.py +268 -0
  41. tikdataapi/errors.py +16 -0
  42. tikdataapi/models/__init__.py +117 -0
  43. tikdataapi/models/batch_error.py +104 -0
  44. tikdataapi/models/batch_error_code.py +15 -0
  45. tikdataapi/models/batch_meta.py +127 -0
  46. tikdataapi/models/batch_meta_cache.py +11 -0
  47. tikdataapi/models/comment.py +163 -0
  48. tikdataapi/models/comment_author.py +97 -0
  49. tikdataapi/models/comment_page.py +130 -0
  50. tikdataapi/models/create_checkout_body.py +63 -0
  51. tikdataapi/models/create_checkout_body_pack.py +11 -0
  52. tikdataapi/models/create_checkout_response_200.py +97 -0
  53. tikdataapi/models/error.py +78 -0
  54. tikdataapi/models/error_body.py +107 -0
  55. tikdataapi/models/error_body_code.py +22 -0
  56. tikdataapi/models/get_me_response_200.py +88 -0
  57. tikdataapi/models/get_users_body.py +61 -0
  58. tikdataapi/models/get_users_videos_body.py +72 -0
  59. tikdataapi/models/get_videos_body.py +61 -0
  60. tikdataapi/models/hashtag.py +124 -0
  61. tikdataapi/models/hashtag_response.py +122 -0
  62. tikdataapi/models/hashtag_summary.py +98 -0
  63. tikdataapi/models/hashtag_summary_page.py +130 -0
  64. tikdataapi/models/list_packs_response_200.py +103 -0
  65. tikdataapi/models/list_packs_response_200_data_item.py +88 -0
  66. tikdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
  67. tikdataapi/models/live_room.py +142 -0
  68. tikdataapi/models/live_room_author.py +90 -0
  69. tikdataapi/models/live_room_page.py +130 -0
  70. tikdataapi/models/live_room_response.py +124 -0
  71. tikdataapi/models/meta.py +108 -0
  72. tikdataapi/models/meta_cache.py +10 -0
  73. tikdataapi/models/music.py +107 -0
  74. tikdataapi/models/music_detail.py +172 -0
  75. tikdataapi/models/music_response.py +124 -0
  76. tikdataapi/models/music_summary.py +137 -0
  77. tikdataapi/models/music_summary_page.py +130 -0
  78. tikdataapi/models/not_found_reason.py +12 -0
  79. tikdataapi/models/playlist.py +114 -0
  80. tikdataapi/models/playlist_author.py +86 -0
  81. tikdataapi/models/playlist_page.py +130 -0
  82. tikdataapi/models/problem.py +131 -0
  83. tikdataapi/models/transcript.py +128 -0
  84. tikdataapi/models/transcript_response.py +124 -0
  85. tikdataapi/models/transcript_segment.py +77 -0
  86. tikdataapi/models/user.py +207 -0
  87. tikdataapi/models/user_batch.py +145 -0
  88. tikdataapi/models/user_page.py +130 -0
  89. tikdataapi/models/user_response.py +126 -0
  90. tikdataapi/models/user_summary.py +152 -0
  91. tikdataapi/models/user_summary_page.py +130 -0
  92. tikdataapi/models/user_videos.py +96 -0
  93. tikdataapi/models/user_videos_batch.py +145 -0
  94. tikdataapi/models/video.py +297 -0
  95. tikdataapi/models/video_batch.py +145 -0
  96. tikdataapi/models/video_page.py +130 -0
  97. tikdataapi/models/video_response.py +122 -0
  98. tikdataapi/models/video_type.py +9 -0
  99. tikdataapi/py.typed +1 -0
  100. tikdataapi/types.py +54 -0
  101. tikdataapi-0.1.0.dist-info/METADATA +148 -0
  102. tikdataapi-0.1.0.dist-info/RECORD +103 -0
  103. tikdataapi-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,254 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.error import Error
10
+ from ...models.video_page import VideoPage
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ id: str,
16
+ *,
17
+ count: int | Unset = 30,
18
+ cursor: str | Unset = UNSET,
19
+ fresh: bool | Unset = False,
20
+ ) -> dict[str, Any]:
21
+
22
+ params: dict[str, Any] = {}
23
+
24
+ params["count"] = count
25
+
26
+ params["cursor"] = cursor
27
+
28
+ params["fresh"] = fresh
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "get",
34
+ "url": "/v1/music/{id}/videos".format(
35
+ id=quote(str(id), safe=""),
36
+ ),
37
+ "params": params,
38
+ }
39
+
40
+ return _kwargs
41
+
42
+
43
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | VideoPage | None:
44
+ if response.status_code == 200:
45
+ response_200 = VideoPage.from_dict(response.json())
46
+
47
+ return response_200
48
+
49
+ if response.status_code == 400:
50
+ response_400 = Error.from_dict(response.json())
51
+
52
+ return response_400
53
+
54
+ if response.status_code == 401:
55
+ response_401 = Error.from_dict(response.json())
56
+
57
+ return response_401
58
+
59
+ if response.status_code == 402:
60
+ response_402 = Error.from_dict(response.json())
61
+
62
+ return response_402
63
+
64
+ if response.status_code == 404:
65
+ response_404 = Error.from_dict(response.json())
66
+
67
+ return response_404
68
+
69
+ if response.status_code == 429:
70
+ response_429 = Error.from_dict(response.json())
71
+
72
+ return response_429
73
+
74
+ if response.status_code == 500:
75
+ response_500 = Error.from_dict(response.json())
76
+
77
+ return response_500
78
+
79
+ if response.status_code == 503:
80
+ response_503 = Error.from_dict(response.json())
81
+
82
+ return response_503
83
+
84
+ if client.raise_on_unexpected_status:
85
+ raise errors.UnexpectedStatus(response.status_code, response.content)
86
+ else:
87
+ return None
88
+
89
+
90
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | VideoPage]:
91
+ return Response(
92
+ status_code=HTTPStatus(response.status_code),
93
+ content=response.content,
94
+ headers=response.headers,
95
+ parsed=_parse_response(client=client, response=response),
96
+ )
97
+
98
+
99
+ def sync_detailed(
100
+ id: str,
101
+ *,
102
+ client: AuthenticatedClient | Client,
103
+ count: int | Unset = 30,
104
+ cursor: str | Unset = UNSET,
105
+ fresh: bool | Unset = False,
106
+ ) -> Response[Error | VideoPage]:
107
+ """Videos of a sound
108
+
109
+ The videos that use a sound, in the order of the sound page of TikTok (popular videos, not newest
110
+ first). 1 credit per video. A sound with no public video gives an empty list, free.
111
+ New on 2026-12-03; its limits at TikTok are not measured yet.
112
+
113
+ Args:
114
+ id (str):
115
+ count (int | Unset): Default: 30.
116
+ cursor (str | Unset):
117
+ fresh (bool | Unset): Default: False.
118
+
119
+ Raises:
120
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
121
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
122
+
123
+ Returns:
124
+ Response[Error | VideoPage]
125
+ """
126
+
127
+ kwargs = _get_kwargs(
128
+ id=id,
129
+ count=count,
130
+ cursor=cursor,
131
+ fresh=fresh,
132
+ )
133
+
134
+ response = client.get_httpx_client().request(
135
+ **kwargs,
136
+ )
137
+
138
+ return _build_response(client=client, response=response)
139
+
140
+
141
+ def sync(
142
+ id: str,
143
+ *,
144
+ client: AuthenticatedClient | Client,
145
+ count: int | Unset = 30,
146
+ cursor: str | Unset = UNSET,
147
+ fresh: bool | Unset = False,
148
+ ) -> Error | VideoPage | None:
149
+ """Videos of a sound
150
+
151
+ The videos that use a sound, in the order of the sound page of TikTok (popular videos, not newest
152
+ first). 1 credit per video. A sound with no public video gives an empty list, free.
153
+ New on 2026-12-03; its limits at TikTok are not measured yet.
154
+
155
+ Args:
156
+ id (str):
157
+ count (int | Unset): Default: 30.
158
+ cursor (str | Unset):
159
+ fresh (bool | Unset): Default: False.
160
+
161
+ Raises:
162
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
163
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
164
+
165
+ Returns:
166
+ Error | VideoPage
167
+ """
168
+
169
+ return sync_detailed(
170
+ id=id,
171
+ client=client,
172
+ count=count,
173
+ cursor=cursor,
174
+ fresh=fresh,
175
+ ).parsed
176
+
177
+
178
+ async def asyncio_detailed(
179
+ id: str,
180
+ *,
181
+ client: AuthenticatedClient | Client,
182
+ count: int | Unset = 30,
183
+ cursor: str | Unset = UNSET,
184
+ fresh: bool | Unset = False,
185
+ ) -> Response[Error | VideoPage]:
186
+ """Videos of a sound
187
+
188
+ The videos that use a sound, in the order of the sound page of TikTok (popular videos, not newest
189
+ first). 1 credit per video. A sound with no public video gives an empty list, free.
190
+ New on 2026-12-03; its limits at TikTok are not measured yet.
191
+
192
+ Args:
193
+ id (str):
194
+ count (int | Unset): Default: 30.
195
+ cursor (str | Unset):
196
+ fresh (bool | Unset): Default: False.
197
+
198
+ Raises:
199
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
200
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
201
+
202
+ Returns:
203
+ Response[Error | VideoPage]
204
+ """
205
+
206
+ kwargs = _get_kwargs(
207
+ id=id,
208
+ count=count,
209
+ cursor=cursor,
210
+ fresh=fresh,
211
+ )
212
+
213
+ response = await client.get_async_httpx_client().request(**kwargs)
214
+
215
+ return _build_response(client=client, response=response)
216
+
217
+
218
+ async def asyncio(
219
+ id: str,
220
+ *,
221
+ client: AuthenticatedClient | Client,
222
+ count: int | Unset = 30,
223
+ cursor: str | Unset = UNSET,
224
+ fresh: bool | Unset = False,
225
+ ) -> Error | VideoPage | None:
226
+ """Videos of a sound
227
+
228
+ The videos that use a sound, in the order of the sound page of TikTok (popular videos, not newest
229
+ first). 1 credit per video. A sound with no public video gives an empty list, free.
230
+ New on 2026-12-03; its limits at TikTok are not measured yet.
231
+
232
+ Args:
233
+ id (str):
234
+ count (int | Unset): Default: 30.
235
+ cursor (str | Unset):
236
+ fresh (bool | Unset): Default: False.
237
+
238
+ Raises:
239
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
240
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
241
+
242
+ Returns:
243
+ Error | VideoPage
244
+ """
245
+
246
+ return (
247
+ await asyncio_detailed(
248
+ id=id,
249
+ client=client,
250
+ count=count,
251
+ cursor=cursor,
252
+ fresh=fresh,
253
+ )
254
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,258 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.error import Error
10
+ from ...models.video_page import VideoPage
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ id: str,
16
+ *,
17
+ count: int | Unset = 30,
18
+ cursor: str | Unset = UNSET,
19
+ fresh: bool | Unset = False,
20
+ ) -> dict[str, Any]:
21
+
22
+ params: dict[str, Any] = {}
23
+
24
+ params["count"] = count
25
+
26
+ params["cursor"] = cursor
27
+
28
+ params["fresh"] = fresh
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "get",
34
+ "url": "/v1/playlists/{id}/videos".format(
35
+ id=quote(str(id), safe=""),
36
+ ),
37
+ "params": params,
38
+ }
39
+
40
+ return _kwargs
41
+
42
+
43
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | VideoPage | None:
44
+ if response.status_code == 200:
45
+ response_200 = VideoPage.from_dict(response.json())
46
+
47
+ return response_200
48
+
49
+ if response.status_code == 400:
50
+ response_400 = Error.from_dict(response.json())
51
+
52
+ return response_400
53
+
54
+ if response.status_code == 401:
55
+ response_401 = Error.from_dict(response.json())
56
+
57
+ return response_401
58
+
59
+ if response.status_code == 402:
60
+ response_402 = Error.from_dict(response.json())
61
+
62
+ return response_402
63
+
64
+ if response.status_code == 404:
65
+ response_404 = Error.from_dict(response.json())
66
+
67
+ return response_404
68
+
69
+ if response.status_code == 429:
70
+ response_429 = Error.from_dict(response.json())
71
+
72
+ return response_429
73
+
74
+ if response.status_code == 500:
75
+ response_500 = Error.from_dict(response.json())
76
+
77
+ return response_500
78
+
79
+ if response.status_code == 503:
80
+ response_503 = Error.from_dict(response.json())
81
+
82
+ return response_503
83
+
84
+ if client.raise_on_unexpected_status:
85
+ raise errors.UnexpectedStatus(response.status_code, response.content)
86
+ else:
87
+ return None
88
+
89
+
90
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | VideoPage]:
91
+ return Response(
92
+ status_code=HTTPStatus(response.status_code),
93
+ content=response.content,
94
+ headers=response.headers,
95
+ parsed=_parse_response(client=client, response=response),
96
+ )
97
+
98
+
99
+ def sync_detailed(
100
+ id: str,
101
+ *,
102
+ client: AuthenticatedClient | Client,
103
+ count: int | Unset = 30,
104
+ cursor: str | Unset = UNSET,
105
+ fresh: bool | Unset = False,
106
+ ) -> Response[Error | VideoPage]:
107
+ """Videos of a playlist
108
+
109
+ The videos of a playlist, in the order of the playlist. 1 credit per video. The id is the `id` of an
110
+ entry of `/v1/users/{user}/playlists`, or the number at the end of the address of the playlist. An
111
+ empty playlist gives an empty list, free.
112
+ New on 2026-12-03; its limits at TikTok are not measured yet.
113
+
114
+ Args:
115
+ id (str):
116
+ count (int | Unset): Default: 30.
117
+ cursor (str | Unset):
118
+ fresh (bool | Unset): Default: False.
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ Response[Error | VideoPage]
126
+ """
127
+
128
+ kwargs = _get_kwargs(
129
+ id=id,
130
+ count=count,
131
+ cursor=cursor,
132
+ fresh=fresh,
133
+ )
134
+
135
+ response = client.get_httpx_client().request(
136
+ **kwargs,
137
+ )
138
+
139
+ return _build_response(client=client, response=response)
140
+
141
+
142
+ def sync(
143
+ id: str,
144
+ *,
145
+ client: AuthenticatedClient | Client,
146
+ count: int | Unset = 30,
147
+ cursor: str | Unset = UNSET,
148
+ fresh: bool | Unset = False,
149
+ ) -> Error | VideoPage | None:
150
+ """Videos of a playlist
151
+
152
+ The videos of a playlist, in the order of the playlist. 1 credit per video. The id is the `id` of an
153
+ entry of `/v1/users/{user}/playlists`, or the number at the end of the address of the playlist. An
154
+ empty playlist gives an empty list, free.
155
+ New on 2026-12-03; its limits at TikTok are not measured yet.
156
+
157
+ Args:
158
+ id (str):
159
+ count (int | Unset): Default: 30.
160
+ cursor (str | Unset):
161
+ fresh (bool | Unset): Default: False.
162
+
163
+ Raises:
164
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
165
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
166
+
167
+ Returns:
168
+ Error | VideoPage
169
+ """
170
+
171
+ return sync_detailed(
172
+ id=id,
173
+ client=client,
174
+ count=count,
175
+ cursor=cursor,
176
+ fresh=fresh,
177
+ ).parsed
178
+
179
+
180
+ async def asyncio_detailed(
181
+ id: str,
182
+ *,
183
+ client: AuthenticatedClient | Client,
184
+ count: int | Unset = 30,
185
+ cursor: str | Unset = UNSET,
186
+ fresh: bool | Unset = False,
187
+ ) -> Response[Error | VideoPage]:
188
+ """Videos of a playlist
189
+
190
+ The videos of a playlist, in the order of the playlist. 1 credit per video. The id is the `id` of an
191
+ entry of `/v1/users/{user}/playlists`, or the number at the end of the address of the playlist. An
192
+ empty playlist gives an empty list, free.
193
+ New on 2026-12-03; its limits at TikTok are not measured yet.
194
+
195
+ Args:
196
+ id (str):
197
+ count (int | Unset): Default: 30.
198
+ cursor (str | Unset):
199
+ fresh (bool | Unset): Default: False.
200
+
201
+ Raises:
202
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
203
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
204
+
205
+ Returns:
206
+ Response[Error | VideoPage]
207
+ """
208
+
209
+ kwargs = _get_kwargs(
210
+ id=id,
211
+ count=count,
212
+ cursor=cursor,
213
+ fresh=fresh,
214
+ )
215
+
216
+ response = await client.get_async_httpx_client().request(**kwargs)
217
+
218
+ return _build_response(client=client, response=response)
219
+
220
+
221
+ async def asyncio(
222
+ id: str,
223
+ *,
224
+ client: AuthenticatedClient | Client,
225
+ count: int | Unset = 30,
226
+ cursor: str | Unset = UNSET,
227
+ fresh: bool | Unset = False,
228
+ ) -> Error | VideoPage | None:
229
+ """Videos of a playlist
230
+
231
+ The videos of a playlist, in the order of the playlist. 1 credit per video. The id is the `id` of an
232
+ entry of `/v1/users/{user}/playlists`, or the number at the end of the address of the playlist. An
233
+ empty playlist gives an empty list, free.
234
+ New on 2026-12-03; its limits at TikTok are not measured yet.
235
+
236
+ Args:
237
+ id (str):
238
+ count (int | Unset): Default: 30.
239
+ cursor (str | Unset):
240
+ fresh (bool | Unset): Default: False.
241
+
242
+ Raises:
243
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
244
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
245
+
246
+ Returns:
247
+ Error | VideoPage
248
+ """
249
+
250
+ return (
251
+ await asyncio_detailed(
252
+ id=id,
253
+ client=client,
254
+ count=count,
255
+ cursor=cursor,
256
+ fresh=fresh,
257
+ )
258
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""