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.
- tikdataapi/__init__.py +8 -0
- tikdataapi/api/__init__.py +1 -0
- tikdataapi/api/account/__init__.py +1 -0
- tikdataapi/api/account/get_me.py +144 -0
- tikdataapi/api/billing/__init__.py +1 -0
- tikdataapi/api/billing/create_checkout.py +215 -0
- tikdataapi/api/billing/list_packs.py +144 -0
- tikdataapi/api/hashtags/__init__.py +1 -0
- tikdataapi/api/hashtags/get_hashtag.py +220 -0
- tikdataapi/api/hashtags/get_hashtag_videos.py +250 -0
- tikdataapi/api/music/__init__.py +1 -0
- tikdataapi/api/music/get_music.py +234 -0
- tikdataapi/api/music/get_music_videos.py +254 -0
- tikdataapi/api/playlists/__init__.py +1 -0
- tikdataapi/api/playlists/get_playlist_videos.py +258 -0
- tikdataapi/api/search/__init__.py +1 -0
- tikdataapi/api/search/search_hashtags.py +261 -0
- tikdataapi/api/search/search_live.py +258 -0
- tikdataapi/api/search/search_music.py +260 -0
- tikdataapi/api/search/search_users.py +276 -0
- tikdataapi/api/search/search_videos.py +260 -0
- tikdataapi/api/users/__init__.py +1 -0
- tikdataapi/api/users/get_user.py +222 -0
- tikdataapi/api/users/get_user_followers.py +266 -0
- tikdataapi/api/users/get_user_following.py +266 -0
- tikdataapi/api/users/get_user_live.py +236 -0
- tikdataapi/api/users/get_user_playlists.py +276 -0
- tikdataapi/api/users/get_user_reposts.py +266 -0
- tikdataapi/api/users/get_user_videos.py +254 -0
- tikdataapi/api/users/get_users.py +247 -0
- tikdataapi/api/users/get_users_videos.py +259 -0
- tikdataapi/api/videos/__init__.py +1 -0
- tikdataapi/api/videos/get_comment_replies.py +260 -0
- tikdataapi/api/videos/get_comments.py +258 -0
- tikdataapi/api/videos/get_related_videos.py +247 -0
- tikdataapi/api/videos/get_trending_videos.py +238 -0
- tikdataapi/api/videos/get_video.py +218 -0
- tikdataapi/api/videos/get_video_transcript.py +247 -0
- tikdataapi/api/videos/get_videos.py +235 -0
- tikdataapi/client.py +268 -0
- tikdataapi/errors.py +16 -0
- tikdataapi/models/__init__.py +117 -0
- tikdataapi/models/batch_error.py +104 -0
- tikdataapi/models/batch_error_code.py +15 -0
- tikdataapi/models/batch_meta.py +127 -0
- tikdataapi/models/batch_meta_cache.py +11 -0
- tikdataapi/models/comment.py +163 -0
- tikdataapi/models/comment_author.py +97 -0
- tikdataapi/models/comment_page.py +130 -0
- tikdataapi/models/create_checkout_body.py +63 -0
- tikdataapi/models/create_checkout_body_pack.py +11 -0
- tikdataapi/models/create_checkout_response_200.py +97 -0
- tikdataapi/models/error.py +78 -0
- tikdataapi/models/error_body.py +107 -0
- tikdataapi/models/error_body_code.py +22 -0
- tikdataapi/models/get_me_response_200.py +88 -0
- tikdataapi/models/get_users_body.py +61 -0
- tikdataapi/models/get_users_videos_body.py +72 -0
- tikdataapi/models/get_videos_body.py +61 -0
- tikdataapi/models/hashtag.py +124 -0
- tikdataapi/models/hashtag_response.py +122 -0
- tikdataapi/models/hashtag_summary.py +98 -0
- tikdataapi/models/hashtag_summary_page.py +130 -0
- tikdataapi/models/list_packs_response_200.py +103 -0
- tikdataapi/models/list_packs_response_200_data_item.py +88 -0
- tikdataapi/models/list_packs_response_200_rate_limits_item.py +70 -0
- tikdataapi/models/live_room.py +142 -0
- tikdataapi/models/live_room_author.py +90 -0
- tikdataapi/models/live_room_page.py +130 -0
- tikdataapi/models/live_room_response.py +124 -0
- tikdataapi/models/meta.py +108 -0
- tikdataapi/models/meta_cache.py +10 -0
- tikdataapi/models/music.py +107 -0
- tikdataapi/models/music_detail.py +172 -0
- tikdataapi/models/music_response.py +124 -0
- tikdataapi/models/music_summary.py +137 -0
- tikdataapi/models/music_summary_page.py +130 -0
- tikdataapi/models/not_found_reason.py +12 -0
- tikdataapi/models/playlist.py +114 -0
- tikdataapi/models/playlist_author.py +86 -0
- tikdataapi/models/playlist_page.py +130 -0
- tikdataapi/models/problem.py +131 -0
- tikdataapi/models/transcript.py +128 -0
- tikdataapi/models/transcript_response.py +124 -0
- tikdataapi/models/transcript_segment.py +77 -0
- tikdataapi/models/user.py +207 -0
- tikdataapi/models/user_batch.py +145 -0
- tikdataapi/models/user_page.py +130 -0
- tikdataapi/models/user_response.py +126 -0
- tikdataapi/models/user_summary.py +152 -0
- tikdataapi/models/user_summary_page.py +130 -0
- tikdataapi/models/user_videos.py +96 -0
- tikdataapi/models/user_videos_batch.py +145 -0
- tikdataapi/models/video.py +297 -0
- tikdataapi/models/video_batch.py +145 -0
- tikdataapi/models/video_page.py +130 -0
- tikdataapi/models/video_response.py +122 -0
- tikdataapi/models/video_type.py +9 -0
- tikdataapi/py.typed +1 -0
- tikdataapi/types.py +54 -0
- tikdataapi-0.1.0.dist-info/METADATA +148 -0
- tikdataapi-0.1.0.dist-info/RECORD +103 -0
- tikdataapi-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="MusicDetail")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class MusicDetail:
|
|
17
|
+
"""A sound (music) read by its id: the fields of `Music`, the sound of a video, and more. A sound is a
|
|
18
|
+
published track (with an artist) or an original sound that an account made.
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
id (str): Example: 6696419263248336898.
|
|
22
|
+
title (str): Example: Halo.
|
|
23
|
+
copyrighted (bool): `true`: TikTok marks the sound as a licensed, copyrighted track.
|
|
24
|
+
videos (int): Videos that use the sound. Rounded by TikTok (for example 73900). Example: 73900.
|
|
25
|
+
collected_at (datetime.datetime): When we read this sound from TikTok. A sound from cache keeps the time of its
|
|
26
|
+
own read. Example: 2026-12-03T19:30:00Z.
|
|
27
|
+
author (str | Unset): The name of the artist or of the account that made the sound. Example: Beyoncé.
|
|
28
|
+
original (bool | Unset): `true`: a sound that an account made, not a published track.
|
|
29
|
+
duration (int | Unset): Seconds.
|
|
30
|
+
cover_url (str | Unset): Signed image address; it stops working after some days.
|
|
31
|
+
album (str | Unset): The album of a published track, when TikTok sends it.
|
|
32
|
+
play_url (str | Unset): The audio file, when TikTok sends it. Signed address; it stops working after some days.
|
|
33
|
+
artist_username (str | Unset): The username of the official account of the artist of a published track, when
|
|
34
|
+
TikTok links one. Example: beyonce.
|
|
35
|
+
author_username (str | Unset): The username of the account that made an original sound, when TikTok sends it.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
id: str
|
|
39
|
+
title: str
|
|
40
|
+
copyrighted: bool
|
|
41
|
+
videos: int
|
|
42
|
+
collected_at: datetime.datetime
|
|
43
|
+
author: str | Unset = UNSET
|
|
44
|
+
original: bool | Unset = UNSET
|
|
45
|
+
duration: int | Unset = UNSET
|
|
46
|
+
cover_url: str | Unset = UNSET
|
|
47
|
+
album: str | Unset = UNSET
|
|
48
|
+
play_url: str | Unset = UNSET
|
|
49
|
+
artist_username: str | Unset = UNSET
|
|
50
|
+
author_username: str | Unset = UNSET
|
|
51
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> dict[str, Any]:
|
|
54
|
+
id = self.id
|
|
55
|
+
|
|
56
|
+
title = self.title
|
|
57
|
+
|
|
58
|
+
copyrighted = self.copyrighted
|
|
59
|
+
|
|
60
|
+
videos = self.videos
|
|
61
|
+
|
|
62
|
+
collected_at = self.collected_at.isoformat()
|
|
63
|
+
|
|
64
|
+
author = self.author
|
|
65
|
+
|
|
66
|
+
original = self.original
|
|
67
|
+
|
|
68
|
+
duration = self.duration
|
|
69
|
+
|
|
70
|
+
cover_url = self.cover_url
|
|
71
|
+
|
|
72
|
+
album = self.album
|
|
73
|
+
|
|
74
|
+
play_url = self.play_url
|
|
75
|
+
|
|
76
|
+
artist_username = self.artist_username
|
|
77
|
+
|
|
78
|
+
author_username = self.author_username
|
|
79
|
+
|
|
80
|
+
field_dict: dict[str, Any] = {}
|
|
81
|
+
field_dict.update(self.additional_properties)
|
|
82
|
+
field_dict.update(
|
|
83
|
+
{
|
|
84
|
+
"id": id,
|
|
85
|
+
"title": title,
|
|
86
|
+
"copyrighted": copyrighted,
|
|
87
|
+
"videos": videos,
|
|
88
|
+
"collected_at": collected_at,
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
if author is not UNSET:
|
|
92
|
+
field_dict["author"] = author
|
|
93
|
+
if original is not UNSET:
|
|
94
|
+
field_dict["original"] = original
|
|
95
|
+
if duration is not UNSET:
|
|
96
|
+
field_dict["duration"] = duration
|
|
97
|
+
if cover_url is not UNSET:
|
|
98
|
+
field_dict["cover_url"] = cover_url
|
|
99
|
+
if album is not UNSET:
|
|
100
|
+
field_dict["album"] = album
|
|
101
|
+
if play_url is not UNSET:
|
|
102
|
+
field_dict["play_url"] = play_url
|
|
103
|
+
if artist_username is not UNSET:
|
|
104
|
+
field_dict["artist_username"] = artist_username
|
|
105
|
+
if author_username is not UNSET:
|
|
106
|
+
field_dict["author_username"] = author_username
|
|
107
|
+
|
|
108
|
+
return field_dict
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
112
|
+
d = dict(src_dict)
|
|
113
|
+
id = d.pop("id")
|
|
114
|
+
|
|
115
|
+
title = d.pop("title")
|
|
116
|
+
|
|
117
|
+
copyrighted = d.pop("copyrighted")
|
|
118
|
+
|
|
119
|
+
videos = d.pop("videos")
|
|
120
|
+
|
|
121
|
+
collected_at = datetime.datetime.fromisoformat(d.pop("collected_at"))
|
|
122
|
+
|
|
123
|
+
author = d.pop("author", UNSET)
|
|
124
|
+
|
|
125
|
+
original = d.pop("original", UNSET)
|
|
126
|
+
|
|
127
|
+
duration = d.pop("duration", UNSET)
|
|
128
|
+
|
|
129
|
+
cover_url = d.pop("cover_url", UNSET)
|
|
130
|
+
|
|
131
|
+
album = d.pop("album", UNSET)
|
|
132
|
+
|
|
133
|
+
play_url = d.pop("play_url", UNSET)
|
|
134
|
+
|
|
135
|
+
artist_username = d.pop("artist_username", UNSET)
|
|
136
|
+
|
|
137
|
+
author_username = d.pop("author_username", UNSET)
|
|
138
|
+
|
|
139
|
+
music_detail = cls(
|
|
140
|
+
id=id,
|
|
141
|
+
title=title,
|
|
142
|
+
copyrighted=copyrighted,
|
|
143
|
+
videos=videos,
|
|
144
|
+
collected_at=collected_at,
|
|
145
|
+
author=author,
|
|
146
|
+
original=original,
|
|
147
|
+
duration=duration,
|
|
148
|
+
cover_url=cover_url,
|
|
149
|
+
album=album,
|
|
150
|
+
play_url=play_url,
|
|
151
|
+
artist_username=artist_username,
|
|
152
|
+
author_username=author_username,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
music_detail.additional_properties = d
|
|
156
|
+
return music_detail
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
def additional_keys(self) -> list[str]:
|
|
160
|
+
return list(self.additional_properties.keys())
|
|
161
|
+
|
|
162
|
+
def __getitem__(self, key: str) -> Any:
|
|
163
|
+
return self.additional_properties[key]
|
|
164
|
+
|
|
165
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
166
|
+
self.additional_properties[key] = value
|
|
167
|
+
|
|
168
|
+
def __delitem__(self, key: str) -> None:
|
|
169
|
+
del self.additional_properties[key]
|
|
170
|
+
|
|
171
|
+
def __contains__(self, key: str) -> bool:
|
|
172
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.meta_cache import MetaCache
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.music_detail import MusicDetail
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="MusicResponse")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class MusicResponse:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
items (int): Objects returned.
|
|
25
|
+
credits_charged (float): Example: 16.
|
|
26
|
+
balance_remaining (float): Example: 79984.
|
|
27
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
28
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
29
|
+
price of its own source; `hit` means all of it came from cache.
|
|
30
|
+
request_id (UUID):
|
|
31
|
+
data (MusicDetail): A sound (music) read by its id: the fields of `Music`, the sound of a video, and more. A
|
|
32
|
+
sound is a
|
|
33
|
+
published track (with an artist) or an original sound that an account made.
|
|
34
|
+
next_cursor (str | Unset):
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
items: int
|
|
38
|
+
credits_charged: float
|
|
39
|
+
balance_remaining: float
|
|
40
|
+
cache: MetaCache
|
|
41
|
+
request_id: UUID
|
|
42
|
+
data: MusicDetail
|
|
43
|
+
next_cursor: str | Unset = UNSET
|
|
44
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
45
|
+
|
|
46
|
+
def to_dict(self) -> dict[str, Any]:
|
|
47
|
+
items = self.items
|
|
48
|
+
|
|
49
|
+
credits_charged = self.credits_charged
|
|
50
|
+
|
|
51
|
+
balance_remaining = self.balance_remaining
|
|
52
|
+
|
|
53
|
+
cache = self.cache.value
|
|
54
|
+
|
|
55
|
+
request_id = str(self.request_id)
|
|
56
|
+
|
|
57
|
+
data = self.data.to_dict()
|
|
58
|
+
|
|
59
|
+
next_cursor = self.next_cursor
|
|
60
|
+
|
|
61
|
+
field_dict: dict[str, Any] = {}
|
|
62
|
+
field_dict.update(self.additional_properties)
|
|
63
|
+
field_dict.update(
|
|
64
|
+
{
|
|
65
|
+
"items": items,
|
|
66
|
+
"credits_charged": credits_charged,
|
|
67
|
+
"balance_remaining": balance_remaining,
|
|
68
|
+
"cache": cache,
|
|
69
|
+
"request_id": request_id,
|
|
70
|
+
"data": data,
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
if next_cursor is not UNSET:
|
|
74
|
+
field_dict["next_cursor"] = next_cursor
|
|
75
|
+
|
|
76
|
+
return field_dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
80
|
+
from ..models.music_detail import MusicDetail # noqa: PLC0415
|
|
81
|
+
|
|
82
|
+
d = dict(src_dict)
|
|
83
|
+
items = d.pop("items")
|
|
84
|
+
|
|
85
|
+
credits_charged = d.pop("credits_charged")
|
|
86
|
+
|
|
87
|
+
balance_remaining = d.pop("balance_remaining")
|
|
88
|
+
|
|
89
|
+
cache = MetaCache(d.pop("cache"))
|
|
90
|
+
|
|
91
|
+
request_id = UUID(d.pop("request_id"))
|
|
92
|
+
|
|
93
|
+
data = MusicDetail.from_dict(d.pop("data"))
|
|
94
|
+
|
|
95
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
96
|
+
|
|
97
|
+
music_response = cls(
|
|
98
|
+
items=items,
|
|
99
|
+
credits_charged=credits_charged,
|
|
100
|
+
balance_remaining=balance_remaining,
|
|
101
|
+
cache=cache,
|
|
102
|
+
request_id=request_id,
|
|
103
|
+
data=data,
|
|
104
|
+
next_cursor=next_cursor,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
music_response.additional_properties = d
|
|
108
|
+
return music_response
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def additional_keys(self) -> list[str]:
|
|
112
|
+
return list(self.additional_properties.keys())
|
|
113
|
+
|
|
114
|
+
def __getitem__(self, key: str) -> Any:
|
|
115
|
+
return self.additional_properties[key]
|
|
116
|
+
|
|
117
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
118
|
+
self.additional_properties[key] = value
|
|
119
|
+
|
|
120
|
+
def __delitem__(self, key: str) -> None:
|
|
121
|
+
del self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __contains__(self, key: str) -> bool:
|
|
124
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="MusicSummary")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class MusicSummary:
|
|
17
|
+
"""A sound in the results of a sound search: a short sound, what the sound search of TikTok sends. For
|
|
18
|
+
the full sound, read `/v1/music/{id}`; for its videos, `/v1/music/{id}/videos`.
|
|
19
|
+
|
|
20
|
+
Attributes:
|
|
21
|
+
id (str): The id of the sound, as for `/v1/music/{id}`. Example: 6696419263248336898.
|
|
22
|
+
title (str): Example: Halo.
|
|
23
|
+
author (str): The name of the artist or of the account that made the sound. Example: Beyoncé.
|
|
24
|
+
collected_at (datetime.datetime): When we read this entry from TikTok. An entry from cache keeps the time of its
|
|
25
|
+
own read. Example: 2026-12-03T19:45:00Z.
|
|
26
|
+
album (str | Unset): The album of a published track, when TikTok sends it.
|
|
27
|
+
duration (int | Unset): Seconds, when TikTok sends it.
|
|
28
|
+
cover_url (str | Unset): Signed image address; it stops working after some days.
|
|
29
|
+
original (bool | Unset): `true`: a sound that an account made, not a published track. Absent when TikTok does
|
|
30
|
+
not say.
|
|
31
|
+
videos (int | Unset): Videos that use the sound, when the search result carries the count. Rounded by TikTok.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
id: str
|
|
35
|
+
title: str
|
|
36
|
+
author: str
|
|
37
|
+
collected_at: datetime.datetime
|
|
38
|
+
album: str | Unset = UNSET
|
|
39
|
+
duration: int | Unset = UNSET
|
|
40
|
+
cover_url: str | Unset = UNSET
|
|
41
|
+
original: bool | Unset = UNSET
|
|
42
|
+
videos: int | Unset = UNSET
|
|
43
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
44
|
+
|
|
45
|
+
def to_dict(self) -> dict[str, Any]:
|
|
46
|
+
id = self.id
|
|
47
|
+
|
|
48
|
+
title = self.title
|
|
49
|
+
|
|
50
|
+
author = self.author
|
|
51
|
+
|
|
52
|
+
collected_at = self.collected_at.isoformat()
|
|
53
|
+
|
|
54
|
+
album = self.album
|
|
55
|
+
|
|
56
|
+
duration = self.duration
|
|
57
|
+
|
|
58
|
+
cover_url = self.cover_url
|
|
59
|
+
|
|
60
|
+
original = self.original
|
|
61
|
+
|
|
62
|
+
videos = self.videos
|
|
63
|
+
|
|
64
|
+
field_dict: dict[str, Any] = {}
|
|
65
|
+
field_dict.update(self.additional_properties)
|
|
66
|
+
field_dict.update(
|
|
67
|
+
{
|
|
68
|
+
"id": id,
|
|
69
|
+
"title": title,
|
|
70
|
+
"author": author,
|
|
71
|
+
"collected_at": collected_at,
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
if album is not UNSET:
|
|
75
|
+
field_dict["album"] = album
|
|
76
|
+
if duration is not UNSET:
|
|
77
|
+
field_dict["duration"] = duration
|
|
78
|
+
if cover_url is not UNSET:
|
|
79
|
+
field_dict["cover_url"] = cover_url
|
|
80
|
+
if original is not UNSET:
|
|
81
|
+
field_dict["original"] = original
|
|
82
|
+
if videos is not UNSET:
|
|
83
|
+
field_dict["videos"] = videos
|
|
84
|
+
|
|
85
|
+
return field_dict
|
|
86
|
+
|
|
87
|
+
@classmethod
|
|
88
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
89
|
+
d = dict(src_dict)
|
|
90
|
+
id = d.pop("id")
|
|
91
|
+
|
|
92
|
+
title = d.pop("title")
|
|
93
|
+
|
|
94
|
+
author = d.pop("author")
|
|
95
|
+
|
|
96
|
+
collected_at = datetime.datetime.fromisoformat(d.pop("collected_at"))
|
|
97
|
+
|
|
98
|
+
album = d.pop("album", UNSET)
|
|
99
|
+
|
|
100
|
+
duration = d.pop("duration", UNSET)
|
|
101
|
+
|
|
102
|
+
cover_url = d.pop("cover_url", UNSET)
|
|
103
|
+
|
|
104
|
+
original = d.pop("original", UNSET)
|
|
105
|
+
|
|
106
|
+
videos = d.pop("videos", UNSET)
|
|
107
|
+
|
|
108
|
+
music_summary = cls(
|
|
109
|
+
id=id,
|
|
110
|
+
title=title,
|
|
111
|
+
author=author,
|
|
112
|
+
collected_at=collected_at,
|
|
113
|
+
album=album,
|
|
114
|
+
duration=duration,
|
|
115
|
+
cover_url=cover_url,
|
|
116
|
+
original=original,
|
|
117
|
+
videos=videos,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
music_summary.additional_properties = d
|
|
121
|
+
return music_summary
|
|
122
|
+
|
|
123
|
+
@property
|
|
124
|
+
def additional_keys(self) -> list[str]:
|
|
125
|
+
return list(self.additional_properties.keys())
|
|
126
|
+
|
|
127
|
+
def __getitem__(self, key: str) -> Any:
|
|
128
|
+
return self.additional_properties[key]
|
|
129
|
+
|
|
130
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
131
|
+
self.additional_properties[key] = value
|
|
132
|
+
|
|
133
|
+
def __delitem__(self, key: str) -> None:
|
|
134
|
+
del self.additional_properties[key]
|
|
135
|
+
|
|
136
|
+
def __contains__(self, key: str) -> bool:
|
|
137
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..models.meta_cache import MetaCache
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.music_summary import MusicSummary
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="MusicSummaryPage")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class MusicSummaryPage:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
items (int): Objects returned.
|
|
25
|
+
credits_charged (float): Example: 16.
|
|
26
|
+
balance_remaining (float): Example: 79984.
|
|
27
|
+
cache (MetaCache): `miss`: read from TikTok, normal price. `hit`: from cache, half price. `bypass`: `fresh=true`
|
|
28
|
+
skipped a cached copy, 2x. A page that has cached and new items is `miss` (or `bypass`), and each item costs the
|
|
29
|
+
price of its own source; `hit` means all of it came from cache.
|
|
30
|
+
request_id (UUID):
|
|
31
|
+
data (list[MusicSummary]):
|
|
32
|
+
next_cursor (str | Unset):
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
items: int
|
|
36
|
+
credits_charged: float
|
|
37
|
+
balance_remaining: float
|
|
38
|
+
cache: MetaCache
|
|
39
|
+
request_id: UUID
|
|
40
|
+
data: list[MusicSummary]
|
|
41
|
+
next_cursor: str | Unset = UNSET
|
|
42
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
43
|
+
|
|
44
|
+
def to_dict(self) -> dict[str, Any]:
|
|
45
|
+
items = self.items
|
|
46
|
+
|
|
47
|
+
credits_charged = self.credits_charged
|
|
48
|
+
|
|
49
|
+
balance_remaining = self.balance_remaining
|
|
50
|
+
|
|
51
|
+
cache = self.cache.value
|
|
52
|
+
|
|
53
|
+
request_id = str(self.request_id)
|
|
54
|
+
|
|
55
|
+
data = []
|
|
56
|
+
for data_item_data in self.data:
|
|
57
|
+
data_item = data_item_data.to_dict()
|
|
58
|
+
data.append(data_item)
|
|
59
|
+
|
|
60
|
+
next_cursor = self.next_cursor
|
|
61
|
+
|
|
62
|
+
field_dict: dict[str, Any] = {}
|
|
63
|
+
field_dict.update(self.additional_properties)
|
|
64
|
+
field_dict.update(
|
|
65
|
+
{
|
|
66
|
+
"items": items,
|
|
67
|
+
"credits_charged": credits_charged,
|
|
68
|
+
"balance_remaining": balance_remaining,
|
|
69
|
+
"cache": cache,
|
|
70
|
+
"request_id": request_id,
|
|
71
|
+
"data": data,
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
if next_cursor is not UNSET:
|
|
75
|
+
field_dict["next_cursor"] = next_cursor
|
|
76
|
+
|
|
77
|
+
return field_dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
81
|
+
from ..models.music_summary import MusicSummary # noqa: PLC0415
|
|
82
|
+
|
|
83
|
+
d = dict(src_dict)
|
|
84
|
+
items = d.pop("items")
|
|
85
|
+
|
|
86
|
+
credits_charged = d.pop("credits_charged")
|
|
87
|
+
|
|
88
|
+
balance_remaining = d.pop("balance_remaining")
|
|
89
|
+
|
|
90
|
+
cache = MetaCache(d.pop("cache"))
|
|
91
|
+
|
|
92
|
+
request_id = UUID(d.pop("request_id"))
|
|
93
|
+
|
|
94
|
+
data = []
|
|
95
|
+
_data = d.pop("data")
|
|
96
|
+
for data_item_data in _data:
|
|
97
|
+
data_item = MusicSummary.from_dict(data_item_data)
|
|
98
|
+
|
|
99
|
+
data.append(data_item)
|
|
100
|
+
|
|
101
|
+
next_cursor = d.pop("next_cursor", UNSET)
|
|
102
|
+
|
|
103
|
+
music_summary_page = cls(
|
|
104
|
+
items=items,
|
|
105
|
+
credits_charged=credits_charged,
|
|
106
|
+
balance_remaining=balance_remaining,
|
|
107
|
+
cache=cache,
|
|
108
|
+
request_id=request_id,
|
|
109
|
+
data=data,
|
|
110
|
+
next_cursor=next_cursor,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
music_summary_page.additional_properties = d
|
|
114
|
+
return music_summary_page
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def additional_keys(self) -> list[str]:
|
|
118
|
+
return list(self.additional_properties.keys())
|
|
119
|
+
|
|
120
|
+
def __getitem__(self, key: str) -> Any:
|
|
121
|
+
return self.additional_properties[key]
|
|
122
|
+
|
|
123
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
124
|
+
self.additional_properties[key] = value
|
|
125
|
+
|
|
126
|
+
def __delitem__(self, key: str) -> None:
|
|
127
|
+
del self.additional_properties[key]
|
|
128
|
+
|
|
129
|
+
def __contains__(self, key: str) -> bool:
|
|
130
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
from ..types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ..models.playlist_author import PlaylistAuthor
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="Playlist")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class Playlist:
|
|
21
|
+
"""A playlist that an account made (TikTok calls it a "mix"). Read its videos with
|
|
22
|
+
`/v1/playlists/{id}/videos`.
|
|
23
|
+
|
|
24
|
+
Attributes:
|
|
25
|
+
id (str): Example: 7681171537575824159.
|
|
26
|
+
name (str): Example: Songs Of The Summer 2026.
|
|
27
|
+
videos (int): Videos in the playlist. Example: 3.
|
|
28
|
+
author (PlaylistAuthor): The account that made a playlist.
|
|
29
|
+
collected_at (datetime.datetime): When we read this entry from TikTok. An entry from cache keeps the time of its
|
|
30
|
+
own read. Example: 2026-12-03T19:30:00Z.
|
|
31
|
+
cover_url (str | Unset): Signed image address; it stops working after some days.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
id: str
|
|
35
|
+
name: str
|
|
36
|
+
videos: int
|
|
37
|
+
author: PlaylistAuthor
|
|
38
|
+
collected_at: datetime.datetime
|
|
39
|
+
cover_url: str | Unset = UNSET
|
|
40
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
41
|
+
|
|
42
|
+
def to_dict(self) -> dict[str, Any]:
|
|
43
|
+
id = self.id
|
|
44
|
+
|
|
45
|
+
name = self.name
|
|
46
|
+
|
|
47
|
+
videos = self.videos
|
|
48
|
+
|
|
49
|
+
author = self.author.to_dict()
|
|
50
|
+
|
|
51
|
+
collected_at = self.collected_at.isoformat()
|
|
52
|
+
|
|
53
|
+
cover_url = self.cover_url
|
|
54
|
+
|
|
55
|
+
field_dict: dict[str, Any] = {}
|
|
56
|
+
field_dict.update(self.additional_properties)
|
|
57
|
+
field_dict.update(
|
|
58
|
+
{
|
|
59
|
+
"id": id,
|
|
60
|
+
"name": name,
|
|
61
|
+
"videos": videos,
|
|
62
|
+
"author": author,
|
|
63
|
+
"collected_at": collected_at,
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
if cover_url is not UNSET:
|
|
67
|
+
field_dict["cover_url"] = cover_url
|
|
68
|
+
|
|
69
|
+
return field_dict
|
|
70
|
+
|
|
71
|
+
@classmethod
|
|
72
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
73
|
+
from ..models.playlist_author import PlaylistAuthor # noqa: PLC0415
|
|
74
|
+
|
|
75
|
+
d = dict(src_dict)
|
|
76
|
+
id = d.pop("id")
|
|
77
|
+
|
|
78
|
+
name = d.pop("name")
|
|
79
|
+
|
|
80
|
+
videos = d.pop("videos")
|
|
81
|
+
|
|
82
|
+
author = PlaylistAuthor.from_dict(d.pop("author"))
|
|
83
|
+
|
|
84
|
+
collected_at = datetime.datetime.fromisoformat(d.pop("collected_at"))
|
|
85
|
+
|
|
86
|
+
cover_url = d.pop("cover_url", UNSET)
|
|
87
|
+
|
|
88
|
+
playlist = cls(
|
|
89
|
+
id=id,
|
|
90
|
+
name=name,
|
|
91
|
+
videos=videos,
|
|
92
|
+
author=author,
|
|
93
|
+
collected_at=collected_at,
|
|
94
|
+
cover_url=cover_url,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
playlist.additional_properties = d
|
|
98
|
+
return playlist
|
|
99
|
+
|
|
100
|
+
@property
|
|
101
|
+
def additional_keys(self) -> list[str]:
|
|
102
|
+
return list(self.additional_properties.keys())
|
|
103
|
+
|
|
104
|
+
def __getitem__(self, key: str) -> Any:
|
|
105
|
+
return self.additional_properties[key]
|
|
106
|
+
|
|
107
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
108
|
+
self.additional_properties[key] = value
|
|
109
|
+
|
|
110
|
+
def __delitem__(self, key: str) -> None:
|
|
111
|
+
del self.additional_properties[key]
|
|
112
|
+
|
|
113
|
+
def __contains__(self, key: str) -> bool:
|
|
114
|
+
return key in self.additional_properties
|