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,220 @@
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.hashtag_response import HashtagResponse
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ name: str,
16
+ *,
17
+ fresh: bool | Unset = False,
18
+ ) -> dict[str, Any]:
19
+
20
+ params: dict[str, Any] = {}
21
+
22
+ params["fresh"] = fresh
23
+
24
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "get",
28
+ "url": "/v1/hashtags/{name}".format(
29
+ name=quote(str(name), safe=""),
30
+ ),
31
+ "params": params,
32
+ }
33
+
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: AuthenticatedClient | Client, response: httpx.Response
39
+ ) -> Error | HashtagResponse | None:
40
+ if response.status_code == 200:
41
+ response_200 = HashtagResponse.from_dict(response.json())
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 400:
46
+ response_400 = Error.from_dict(response.json())
47
+
48
+ return response_400
49
+
50
+ if response.status_code == 401:
51
+ response_401 = Error.from_dict(response.json())
52
+
53
+ return response_401
54
+
55
+ if response.status_code == 402:
56
+ response_402 = Error.from_dict(response.json())
57
+
58
+ return response_402
59
+
60
+ if response.status_code == 404:
61
+ response_404 = Error.from_dict(response.json())
62
+
63
+ return response_404
64
+
65
+ if response.status_code == 429:
66
+ response_429 = Error.from_dict(response.json())
67
+
68
+ return response_429
69
+
70
+ if response.status_code == 500:
71
+ response_500 = Error.from_dict(response.json())
72
+
73
+ return response_500
74
+
75
+ if response.status_code == 503:
76
+ response_503 = Error.from_dict(response.json())
77
+
78
+ return response_503
79
+
80
+ if client.raise_on_unexpected_status:
81
+ raise errors.UnexpectedStatus(response.status_code, response.content)
82
+ else:
83
+ return None
84
+
85
+
86
+ def _build_response(
87
+ *, client: AuthenticatedClient | Client, response: httpx.Response
88
+ ) -> Response[Error | HashtagResponse]:
89
+ return Response(
90
+ status_code=HTTPStatus(response.status_code),
91
+ content=response.content,
92
+ headers=response.headers,
93
+ parsed=_parse_response(client=client, response=response),
94
+ )
95
+
96
+
97
+ def sync_detailed(
98
+ name: str,
99
+ *,
100
+ client: AuthenticatedClient | Client,
101
+ fresh: bool | Unset = False,
102
+ ) -> Response[Error | HashtagResponse]:
103
+ """Hashtag by name
104
+
105
+ 1 credit. `name` is the hashtag with or without `#`, in any case.
106
+
107
+ Args:
108
+ name (str):
109
+ fresh (bool | Unset): Default: False.
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ Response[Error | HashtagResponse]
117
+ """
118
+
119
+ kwargs = _get_kwargs(
120
+ name=name,
121
+ fresh=fresh,
122
+ )
123
+
124
+ response = client.get_httpx_client().request(
125
+ **kwargs,
126
+ )
127
+
128
+ return _build_response(client=client, response=response)
129
+
130
+
131
+ def sync(
132
+ name: str,
133
+ *,
134
+ client: AuthenticatedClient | Client,
135
+ fresh: bool | Unset = False,
136
+ ) -> Error | HashtagResponse | None:
137
+ """Hashtag by name
138
+
139
+ 1 credit. `name` is the hashtag with or without `#`, in any case.
140
+
141
+ Args:
142
+ name (str):
143
+ fresh (bool | Unset): Default: False.
144
+
145
+ Raises:
146
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
148
+
149
+ Returns:
150
+ Error | HashtagResponse
151
+ """
152
+
153
+ return sync_detailed(
154
+ name=name,
155
+ client=client,
156
+ fresh=fresh,
157
+ ).parsed
158
+
159
+
160
+ async def asyncio_detailed(
161
+ name: str,
162
+ *,
163
+ client: AuthenticatedClient | Client,
164
+ fresh: bool | Unset = False,
165
+ ) -> Response[Error | HashtagResponse]:
166
+ """Hashtag by name
167
+
168
+ 1 credit. `name` is the hashtag with or without `#`, in any case.
169
+
170
+ Args:
171
+ name (str):
172
+ fresh (bool | Unset): Default: False.
173
+
174
+ Raises:
175
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
176
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
177
+
178
+ Returns:
179
+ Response[Error | HashtagResponse]
180
+ """
181
+
182
+ kwargs = _get_kwargs(
183
+ name=name,
184
+ fresh=fresh,
185
+ )
186
+
187
+ response = await client.get_async_httpx_client().request(**kwargs)
188
+
189
+ return _build_response(client=client, response=response)
190
+
191
+
192
+ async def asyncio(
193
+ name: str,
194
+ *,
195
+ client: AuthenticatedClient | Client,
196
+ fresh: bool | Unset = False,
197
+ ) -> Error | HashtagResponse | None:
198
+ """Hashtag by name
199
+
200
+ 1 credit. `name` is the hashtag with or without `#`, in any case.
201
+
202
+ Args:
203
+ name (str):
204
+ fresh (bool | Unset): Default: False.
205
+
206
+ Raises:
207
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
208
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
209
+
210
+ Returns:
211
+ Error | HashtagResponse
212
+ """
213
+
214
+ return (
215
+ await asyncio_detailed(
216
+ name=name,
217
+ client=client,
218
+ fresh=fresh,
219
+ )
220
+ ).parsed
@@ -0,0 +1,250 @@
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
+ name: 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/hashtags/{name}/videos".format(
35
+ name=quote(str(name), 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
+ name: 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 hashtag
108
+
109
+ 1 credit per video, in the order of TikTok for the hashtag page (popular videos, not newest first).
110
+ The hashtag is changed to its id through the hashtag lookup, free.
111
+
112
+ Args:
113
+ name (str):
114
+ count (int | Unset): Default: 30.
115
+ cursor (str | Unset):
116
+ fresh (bool | Unset): Default: False.
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ Response[Error | VideoPage]
124
+ """
125
+
126
+ kwargs = _get_kwargs(
127
+ name=name,
128
+ count=count,
129
+ cursor=cursor,
130
+ fresh=fresh,
131
+ )
132
+
133
+ response = client.get_httpx_client().request(
134
+ **kwargs,
135
+ )
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ def sync(
141
+ name: str,
142
+ *,
143
+ client: AuthenticatedClient | Client,
144
+ count: int | Unset = 30,
145
+ cursor: str | Unset = UNSET,
146
+ fresh: bool | Unset = False,
147
+ ) -> Error | VideoPage | None:
148
+ """Videos of a hashtag
149
+
150
+ 1 credit per video, in the order of TikTok for the hashtag page (popular videos, not newest first).
151
+ The hashtag is changed to its id through the hashtag lookup, free.
152
+
153
+ Args:
154
+ name (str):
155
+ count (int | Unset): Default: 30.
156
+ cursor (str | Unset):
157
+ fresh (bool | Unset): Default: False.
158
+
159
+ Raises:
160
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
162
+
163
+ Returns:
164
+ Error | VideoPage
165
+ """
166
+
167
+ return sync_detailed(
168
+ name=name,
169
+ client=client,
170
+ count=count,
171
+ cursor=cursor,
172
+ fresh=fresh,
173
+ ).parsed
174
+
175
+
176
+ async def asyncio_detailed(
177
+ name: str,
178
+ *,
179
+ client: AuthenticatedClient | Client,
180
+ count: int | Unset = 30,
181
+ cursor: str | Unset = UNSET,
182
+ fresh: bool | Unset = False,
183
+ ) -> Response[Error | VideoPage]:
184
+ """Videos of a hashtag
185
+
186
+ 1 credit per video, in the order of TikTok for the hashtag page (popular videos, not newest first).
187
+ The hashtag is changed to its id through the hashtag lookup, free.
188
+
189
+ Args:
190
+ name (str):
191
+ count (int | Unset): Default: 30.
192
+ cursor (str | Unset):
193
+ fresh (bool | Unset): Default: False.
194
+
195
+ Raises:
196
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
197
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
198
+
199
+ Returns:
200
+ Response[Error | VideoPage]
201
+ """
202
+
203
+ kwargs = _get_kwargs(
204
+ name=name,
205
+ count=count,
206
+ cursor=cursor,
207
+ fresh=fresh,
208
+ )
209
+
210
+ response = await client.get_async_httpx_client().request(**kwargs)
211
+
212
+ return _build_response(client=client, response=response)
213
+
214
+
215
+ async def asyncio(
216
+ name: str,
217
+ *,
218
+ client: AuthenticatedClient | Client,
219
+ count: int | Unset = 30,
220
+ cursor: str | Unset = UNSET,
221
+ fresh: bool | Unset = False,
222
+ ) -> Error | VideoPage | None:
223
+ """Videos of a hashtag
224
+
225
+ 1 credit per video, in the order of TikTok for the hashtag page (popular videos, not newest first).
226
+ The hashtag is changed to its id through the hashtag lookup, free.
227
+
228
+ Args:
229
+ name (str):
230
+ count (int | Unset): Default: 30.
231
+ cursor (str | Unset):
232
+ fresh (bool | Unset): Default: False.
233
+
234
+ Raises:
235
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
236
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
237
+
238
+ Returns:
239
+ Error | VideoPage
240
+ """
241
+
242
+ return (
243
+ await asyncio_detailed(
244
+ name=name,
245
+ client=client,
246
+ count=count,
247
+ cursor=cursor,
248
+ fresh=fresh,
249
+ )
250
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,234 @@
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.music_response import MusicResponse
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ id: str,
16
+ *,
17
+ fresh: bool | Unset = False,
18
+ ) -> dict[str, Any]:
19
+
20
+ params: dict[str, Any] = {}
21
+
22
+ params["fresh"] = fresh
23
+
24
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "get",
28
+ "url": "/v1/music/{id}".format(
29
+ id=quote(str(id), safe=""),
30
+ ),
31
+ "params": params,
32
+ }
33
+
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | MusicResponse | None:
38
+ if response.status_code == 200:
39
+ response_200 = MusicResponse.from_dict(response.json())
40
+
41
+ return response_200
42
+
43
+ if response.status_code == 400:
44
+ response_400 = Error.from_dict(response.json())
45
+
46
+ return response_400
47
+
48
+ if response.status_code == 401:
49
+ response_401 = Error.from_dict(response.json())
50
+
51
+ return response_401
52
+
53
+ if response.status_code == 402:
54
+ response_402 = Error.from_dict(response.json())
55
+
56
+ return response_402
57
+
58
+ if response.status_code == 404:
59
+ response_404 = Error.from_dict(response.json())
60
+
61
+ return response_404
62
+
63
+ if response.status_code == 429:
64
+ response_429 = Error.from_dict(response.json())
65
+
66
+ return response_429
67
+
68
+ if response.status_code == 500:
69
+ response_500 = Error.from_dict(response.json())
70
+
71
+ return response_500
72
+
73
+ if response.status_code == 503:
74
+ response_503 = Error.from_dict(response.json())
75
+
76
+ return response_503
77
+
78
+ if client.raise_on_unexpected_status:
79
+ raise errors.UnexpectedStatus(response.status_code, response.content)
80
+ else:
81
+ return None
82
+
83
+
84
+ def _build_response(
85
+ *, client: AuthenticatedClient | Client, response: httpx.Response
86
+ ) -> Response[Error | MusicResponse]:
87
+ return Response(
88
+ status_code=HTTPStatus(response.status_code),
89
+ content=response.content,
90
+ headers=response.headers,
91
+ parsed=_parse_response(client=client, response=response),
92
+ )
93
+
94
+
95
+ def sync_detailed(
96
+ id: str,
97
+ *,
98
+ client: AuthenticatedClient | Client,
99
+ fresh: bool | Unset = False,
100
+ ) -> Response[Error | MusicResponse]:
101
+ """Sound by id
102
+
103
+ 1 credit. The id is the number at the end of the address of the sound
104
+ (`https://www.tiktok.com/music/<name>-<id>`), or `music.id` of a video. `videos`, the number of
105
+ videos
106
+ with the sound, is rounded by TikTok.
107
+ New on 2026-12-03; its limits at TikTok are not measured yet.
108
+
109
+ Args:
110
+ id (str):
111
+ fresh (bool | Unset): Default: False.
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ Response[Error | MusicResponse]
119
+ """
120
+
121
+ kwargs = _get_kwargs(
122
+ id=id,
123
+ fresh=fresh,
124
+ )
125
+
126
+ response = client.get_httpx_client().request(
127
+ **kwargs,
128
+ )
129
+
130
+ return _build_response(client=client, response=response)
131
+
132
+
133
+ def sync(
134
+ id: str,
135
+ *,
136
+ client: AuthenticatedClient | Client,
137
+ fresh: bool | Unset = False,
138
+ ) -> Error | MusicResponse | None:
139
+ """Sound by id
140
+
141
+ 1 credit. The id is the number at the end of the address of the sound
142
+ (`https://www.tiktok.com/music/<name>-<id>`), or `music.id` of a video. `videos`, the number of
143
+ videos
144
+ with the sound, is rounded by TikTok.
145
+ New on 2026-12-03; its limits at TikTok are not measured yet.
146
+
147
+ Args:
148
+ id (str):
149
+ fresh (bool | Unset): Default: False.
150
+
151
+ Raises:
152
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
153
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
154
+
155
+ Returns:
156
+ Error | MusicResponse
157
+ """
158
+
159
+ return sync_detailed(
160
+ id=id,
161
+ client=client,
162
+ fresh=fresh,
163
+ ).parsed
164
+
165
+
166
+ async def asyncio_detailed(
167
+ id: str,
168
+ *,
169
+ client: AuthenticatedClient | Client,
170
+ fresh: bool | Unset = False,
171
+ ) -> Response[Error | MusicResponse]:
172
+ """Sound by id
173
+
174
+ 1 credit. The id is the number at the end of the address of the sound
175
+ (`https://www.tiktok.com/music/<name>-<id>`), or `music.id` of a video. `videos`, the number of
176
+ videos
177
+ with the sound, is rounded by TikTok.
178
+ New on 2026-12-03; its limits at TikTok are not measured yet.
179
+
180
+ Args:
181
+ id (str):
182
+ fresh (bool | Unset): Default: False.
183
+
184
+ Raises:
185
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
186
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
187
+
188
+ Returns:
189
+ Response[Error | MusicResponse]
190
+ """
191
+
192
+ kwargs = _get_kwargs(
193
+ id=id,
194
+ fresh=fresh,
195
+ )
196
+
197
+ response = await client.get_async_httpx_client().request(**kwargs)
198
+
199
+ return _build_response(client=client, response=response)
200
+
201
+
202
+ async def asyncio(
203
+ id: str,
204
+ *,
205
+ client: AuthenticatedClient | Client,
206
+ fresh: bool | Unset = False,
207
+ ) -> Error | MusicResponse | None:
208
+ """Sound by id
209
+
210
+ 1 credit. The id is the number at the end of the address of the sound
211
+ (`https://www.tiktok.com/music/<name>-<id>`), or `music.id` of a video. `videos`, the number of
212
+ videos
213
+ with the sound, is rounded by TikTok.
214
+ New on 2026-12-03; its limits at TikTok are not measured yet.
215
+
216
+ Args:
217
+ id (str):
218
+ fresh (bool | Unset): Default: False.
219
+
220
+ Raises:
221
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
222
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
223
+
224
+ Returns:
225
+ Error | MusicResponse
226
+ """
227
+
228
+ return (
229
+ await asyncio_detailed(
230
+ id=id,
231
+ client=client,
232
+ fresh=fresh,
233
+ )
234
+ ).parsed