tiktok-private-api 0.1.0__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 (37) hide show
  1. tiktok_private_api-0.1.0/.gitignore +17 -0
  2. tiktok_private_api-0.1.0/LICENSE +21 -0
  3. tiktok_private_api-0.1.0/PKG-INFO +294 -0
  4. tiktok_private_api-0.1.0/README.md +268 -0
  5. tiktok_private_api-0.1.0/examples/bulk_scraper.py +46 -0
  6. tiktok_private_api-0.1.0/examples/quickstart.py +21 -0
  7. tiktok_private_api-0.1.0/pyproject.toml +41 -0
  8. tiktok_private_api-0.1.0/tiktokflow/__init__.py +47 -0
  9. tiktok_private_api-0.1.0/tiktokflow/android/__init__.py +18 -0
  10. tiktok_private_api-0.1.0/tiktokflow/android/async_client.py +116 -0
  11. tiktok_private_api-0.1.0/tiktokflow/android/async_transport.py +260 -0
  12. tiktok_private_api-0.1.0/tiktokflow/android/client.py +121 -0
  13. tiktok_private_api-0.1.0/tiktokflow/android/comment.py +96 -0
  14. tiktok_private_api-0.1.0/tiktokflow/android/device.py +385 -0
  15. tiktok_private_api-0.1.0/tiktokflow/android/dm.py +198 -0
  16. tiktok_private_api-0.1.0/tiktokflow/android/feed.py +63 -0
  17. tiktok_private_api-0.1.0/tiktokflow/android/fleet.py +353 -0
  18. tiktok_private_api-0.1.0/tiktokflow/android/live.py +142 -0
  19. tiktok_private_api-0.1.0/tiktokflow/android/music.py +98 -0
  20. tiktok_private_api-0.1.0/tiktokflow/android/notice.py +53 -0
  21. tiktok_private_api-0.1.0/tiktokflow/android/passport.py +107 -0
  22. tiktok_private_api-0.1.0/tiktokflow/android/proto_decode.py +256 -0
  23. tiktok_private_api-0.1.0/tiktokflow/android/ratelimit.py +111 -0
  24. tiktok_private_api-0.1.0/tiktokflow/android/register.py +261 -0
  25. tiktok_private_api-0.1.0/tiktokflow/android/remote_signer.py +94 -0
  26. tiktok_private_api-0.1.0/tiktokflow/android/search.py +127 -0
  27. tiktok_private_api-0.1.0/tiktokflow/android/social.py +82 -0
  28. tiktok_private_api-0.1.0/tiktokflow/android/transport.py +781 -0
  29. tiktok_private_api-0.1.0/tiktokflow/android/upload.py +194 -0
  30. tiktok_private_api-0.1.0/tiktokflow/android/user.py +151 -0
  31. tiktok_private_api-0.1.0/tiktokflow/android/video.py +178 -0
  32. tiktok_private_api-0.1.0/tiktokflow/android/web_scraper.py +304 -0
  33. tiktok_private_api-0.1.0/tiktokflow/errors.py +43 -0
  34. tiktok_private_api-0.1.0/tiktokflow/ios/__init__.py +12 -0
  35. tiktok_private_api-0.1.0/tiktokflow/ios/client.py +106 -0
  36. tiktok_private_api-0.1.0/tiktokflow/ios/device.py +401 -0
  37. tiktok_private_api-0.1.0/tiktokflow/ios/transport.py +26 -0
@@ -0,0 +1,17 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .env
10
+ .secrets.env
11
+ *.json
12
+ !examples/*.json
13
+ .venv/
14
+ venv/
15
+ .idea/
16
+ .vscode/
17
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 molkex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,294 @@
1
+ Metadata-Version: 2.5
2
+ Name: tiktok-private-api
3
+ Version: 0.1.0
4
+ Summary: Unofficial TikTok Private API SDK — 50+ endpoints, full mobile signing, Android + iOS
5
+ Project-URL: Homepage, https://github.com/molkex/tiktok-private-api
6
+ Project-URL: Documentation, https://github.com/molkex/tiktok-private-api#endpoints
7
+ Project-URL: Issues, https://github.com/molkex/tiktok-private-api/issues
8
+ Project-URL: Telegram, https://t.me/tiktok_private_api
9
+ Author: molkex
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: private-api,reverse-engineering,social-media-api,tiktok,tiktok-api,tiktok-bot,tiktok-scraper,tiktok-sdk,unofficial-api
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: curl-cffi>=0.7
24
+ Requires-Dist: httpx>=0.27
25
+ Description-Content-Type: text/markdown
26
+
27
+ # tiktok-private-api
28
+
29
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
30
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
31
+ [![PyPI version](https://img.shields.io/pypi/v/tiktok-private-api.svg)](https://pypi.org/project/tiktok-private-api/)
32
+
33
+ **Unofficial TikTok Private API SDK for Python.** Full mobile signing, 50+ endpoints, Android + iOS.
34
+
35
+ ```bash
36
+ pip install tiktok-private-api
37
+ ```
38
+
39
+ ```python
40
+ from tiktokflow import TikTokAPI
41
+
42
+ api = TikTokAPI(api_key="sk_your_key")
43
+
44
+ feed = api.feed.for_you(count=5)
45
+ for video in feed["aweme_list"]:
46
+ print(video["desc"], video["statistics"]["digg_count"], "likes")
47
+ ```
48
+
49
+ **Real output:**
50
+ ```
51
+ Got 8 videos:
52
+ [1] @Nancy Ryan🥀: Welcome to Chicago, the dream city 🤍 (2,021,357 likes)
53
+ [2] @Khabane lame: I had the whole day to charge it… 😭 (5,655,444 likes)
54
+ [3] @marry_cutie: #OOTD #ootdfashion #views (78,053 likes)
55
+ [4] @HSSTECH: Stop Charging Your Samsung Phone Everyday! (61,644 likes)
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Why This SDK
61
+
62
+ | | tiktok-private-api | Official TikTok API | Web scrapers |
63
+ |---|---|---|---|
64
+ | **Endpoints** | 50+ (feed, user, video, search, comment, social, DM, music, live) | ~10 (Display + Content Posting) | 5-10 |
65
+ | **Write actions** | Like, follow, comment, block, delete | Post only | None |
66
+ | **Auth required** | No OAuth app needed | OAuth app + review | No |
67
+ | **Rate limits** | Mobile-grade (high) | Strict quotas | IP-based bans |
68
+ | **TLS fingerprint** | Real device (curl_cffi) | N/A | Browser detected |
69
+ | **Signing** | Full stack (Gorgon + Argus + Ladon + Guard) | N/A | None |
70
+
71
+ ---
72
+
73
+ ## How It Works
74
+
75
+ ```mermaid
76
+ flowchart LR
77
+ A["Your Code"] -->|"api.feed.for_you()"| B["tiktok-private-api\n(SDK)"]
78
+ B -->|"POST /v1/sign"| C["Signing Server\n(cloud)"]
79
+ C -->|"signed headers"| B
80
+ B -->|"GET /aweme/v1/feed/"| D["TikTok\nServers"]
81
+ D -->|"JSON response"| B
82
+ B -->|"parsed data"| A
83
+
84
+ style C fill:#1a1a2e,stroke:#e94560,color:#fff
85
+ style D fill:#1a1a2e,stroke:#00d2ff,color:#fff
86
+ ```
87
+
88
+ - **Your IP → TikTok directly.** The signing server only computes cryptographic headers.
89
+ - It never sees TikTok's responses or your data.
90
+ - Full signing stack: X-Gorgon, X-Argus, X-Ladon, ECDSA Device Guard, Ticket Guard.
91
+
92
+ ---
93
+
94
+ ## Endpoints
95
+
96
+ ### Feed
97
+ | Method | Description |
98
+ |--------|-------------|
99
+ | `api.feed.for_you()` | For You page |
100
+ | `api.feed.following()` | Following feed |
101
+ | `api.feed.user_posts(sec_user_id)` | User's videos |
102
+ | `api.feed.hashtag(ch_id)` | Hashtag feed |
103
+ | `api.feed.music(music_id)` | Music/sound feed |
104
+
105
+ ### User
106
+ | Method | Description |
107
+ |--------|-------------|
108
+ | `api.user.info(sec_user_id)` | User profile |
109
+ | `api.user.profile_self()` | Own profile |
110
+ | `api.user.followers(sec_user_id)` | Follower list |
111
+ | `api.user.following(sec_user_id)` | Following list |
112
+ | `api.user.search(keyword)` | Search users |
113
+ | `api.user.block_list()` | Blocked users |
114
+
115
+ ### Video
116
+ | Method | Description |
117
+ |--------|-------------|
118
+ | `api.video.detail(aweme_id)` | Video info + stats |
119
+ | `api.video.multi_detail(ids)` | Batch video info |
120
+ | `api.video.my_posts()` | Own posted videos |
121
+ | `api.video.favorites()` | Liked videos |
122
+ | `api.video.delete(aweme_id)` | Delete own video |
123
+
124
+ ### Social Actions
125
+ | Method | Description |
126
+ |--------|-------------|
127
+ | `api.social.like(aweme_id)` | Like a video |
128
+ | `api.social.unlike(aweme_id)` | Unlike |
129
+ | `api.social.follow(user_id)` | Follow a user |
130
+ | `api.social.unfollow(user_id)` | Unfollow |
131
+ | `api.social.block(user_id)` | Block a user |
132
+ | `api.social.unblock(user_id)` | Unblock |
133
+
134
+ ### Comments
135
+ | Method | Description |
136
+ |--------|-------------|
137
+ | `api.comment.list(aweme_id)` | Get comments |
138
+ | `api.comment.replies(comment_id)` | Get replies |
139
+ | `api.comment.publish(aweme_id, text)` | Post comment |
140
+ | `api.comment.delete(comment_id)` | Delete comment |
141
+ | `api.comment.like(comment_id)` | Like comment |
142
+
143
+ ### Search
144
+ | Method | Description |
145
+ |--------|-------------|
146
+ | `api.search.general(keyword)` | General search |
147
+ | `api.search.users(keyword)` | Search users |
148
+ | `api.search.videos(keyword)` | Search videos |
149
+ | `api.search.music(keyword)` | Search music |
150
+ | `api.search.hashtags(keyword)` | Search hashtags |
151
+ | `api.search.live(keyword)` | Search lives |
152
+
153
+ ### Music
154
+ | Method | Description |
155
+ |--------|-------------|
156
+ | `api.music.detail(music_id)` | Music/sound info |
157
+ | `api.music.videos(music_id)` | Videos using sound |
158
+
159
+ ### Direct Messages
160
+ | Method | Description |
161
+ |--------|-------------|
162
+ | `api.dm.conversations()` | Conversation list |
163
+ | `api.dm.messages(conversation_id)` | Read messages |
164
+ | `api.dm.unread_count()` | Unread count |
165
+
166
+ ### Live
167
+ | Method | Description |
168
+ |--------|-------------|
169
+ | `api.live.search(keyword)` | Search live streams |
170
+ | `api.live.enter(room_id)` | Enter live room |
171
+
172
+ ### Account
173
+ | Method | Description |
174
+ |--------|-------------|
175
+ | `api.passport.email_login(email, pw)` | Email login |
176
+ | `api.passport.sms_login(phone, code)` | SMS login |
177
+ | `api.passport.register(email, pw)` | Register account |
178
+ | `api.passport.logout()` | Logout |
179
+
180
+ ---
181
+
182
+ ## Setup
183
+
184
+ ### 1. Install
185
+
186
+ ```bash
187
+ pip install tiktok-private-api
188
+ ```
189
+
190
+ ### 2. Get an API key
191
+
192
+ Write me on Telegram — [@mxmtkchk](https://t.me/mxmtkchk).
193
+
194
+ Free keys available for testing. Paid plans for production use.
195
+
196
+ ### 3. Use
197
+
198
+ ```python
199
+ from tiktokflow import TikTokAPI
200
+
201
+ api = TikTokAPI(api_key="sk_your_key_here")
202
+
203
+ feed = api.feed.for_you(count=5)
204
+ print(f"Got {len(feed['aweme_list'])} videos")
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Advanced Usage
210
+
211
+ ### Proxy rotation
212
+
213
+ ```python
214
+ api = TikTokAPI(
215
+ api_key="sk_...",
216
+ proxies=["socks5://user:pass@proxy1:1080", "socks5://user:pass@proxy2:1080"],
217
+ proxy_rotate="round_robin", # or "random"
218
+ )
219
+ ```
220
+
221
+ ### iOS device fingerprint
222
+
223
+ ```python
224
+ api = TikTokAPI(api_key="sk_...", platform="ios")
225
+ ```
226
+
227
+ ### Rate limiting
228
+
229
+ ```python
230
+ api = TikTokAPI(api_key="sk_...", rate_limit=2.0) # max 2 req/sec
231
+ ```
232
+
233
+ ### Session persistence
234
+
235
+ ```python
236
+ api.device.save("my_session.json")
237
+
238
+ # Later:
239
+ from tiktokflow.android import Device
240
+ device = Device.load("my_session.json")
241
+ api = TikTokAPI(api_key="sk_...", device=device)
242
+ ```
243
+
244
+ ### Async
245
+
246
+ ```python
247
+ from tiktokflow.android import AsyncAndroidClient, Device, RemoteSigner
248
+
249
+ signer = RemoteSigner("http://...", "sk_...")
250
+ async with AsyncAndroidClient(Device(), signer=signer) as api:
251
+ feed = await api.feed.for_you(count=10)
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Examples
257
+
258
+ See [examples/](examples/):
259
+
260
+ - [`quickstart.py`](examples/quickstart.py) — Feed + user lookup + like
261
+ - [`bulk_scraper.py`](examples/bulk_scraper.py) — Scrape videos with pagination
262
+
263
+ ---
264
+
265
+ ## SDK vs Competitors
266
+
267
+ | Feature | tiktok-private-api | TikTok-Api (davidteather) | tiktok-scraper |
268
+ |---------|-------------------|--------------------------|----------------|
269
+ | Write endpoints | **Yes** (like, follow, comment) | No | No |
270
+ | Mobile signing | **Full** (Gorgon+Argus+Ladon+Guard) | Partial (browser) | None |
271
+ | Android + iOS | **Yes** | No | No |
272
+ | Proxy rotation | **Built-in** | Manual | Manual |
273
+ | DM access | **Yes** | No | No |
274
+ | Account login | **Yes** | No | No |
275
+ | Maintained | **Yes (2026)** | Sporadic | Archived |
276
+ | Anti-detection | **TLS impersonation** | Browser automation | HTTP only |
277
+
278
+ ---
279
+
280
+ ## Contributing
281
+
282
+ Contributions welcome! Open an issue first to discuss.
283
+
284
+ ## Contact
285
+
286
+ **Telegram:** [@mxmtkchk](https://t.me/mxmtkchk) — support, API keys, feature requests
287
+
288
+ ## License
289
+
290
+ MIT. See [LICENSE](LICENSE).
291
+
292
+ ---
293
+
294
+ *This project is not affiliated with TikTok or ByteDance. Use responsibly.*
@@ -0,0 +1,268 @@
1
+ # tiktok-private-api
2
+
3
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
5
+ [![PyPI version](https://img.shields.io/pypi/v/tiktok-private-api.svg)](https://pypi.org/project/tiktok-private-api/)
6
+
7
+ **Unofficial TikTok Private API SDK for Python.** Full mobile signing, 50+ endpoints, Android + iOS.
8
+
9
+ ```bash
10
+ pip install tiktok-private-api
11
+ ```
12
+
13
+ ```python
14
+ from tiktokflow import TikTokAPI
15
+
16
+ api = TikTokAPI(api_key="sk_your_key")
17
+
18
+ feed = api.feed.for_you(count=5)
19
+ for video in feed["aweme_list"]:
20
+ print(video["desc"], video["statistics"]["digg_count"], "likes")
21
+ ```
22
+
23
+ **Real output:**
24
+ ```
25
+ Got 8 videos:
26
+ [1] @Nancy Ryan🥀: Welcome to Chicago, the dream city 🤍 (2,021,357 likes)
27
+ [2] @Khabane lame: I had the whole day to charge it… 😭 (5,655,444 likes)
28
+ [3] @marry_cutie: #OOTD #ootdfashion #views (78,053 likes)
29
+ [4] @HSSTECH: Stop Charging Your Samsung Phone Everyday! (61,644 likes)
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Why This SDK
35
+
36
+ | | tiktok-private-api | Official TikTok API | Web scrapers |
37
+ |---|---|---|---|
38
+ | **Endpoints** | 50+ (feed, user, video, search, comment, social, DM, music, live) | ~10 (Display + Content Posting) | 5-10 |
39
+ | **Write actions** | Like, follow, comment, block, delete | Post only | None |
40
+ | **Auth required** | No OAuth app needed | OAuth app + review | No |
41
+ | **Rate limits** | Mobile-grade (high) | Strict quotas | IP-based bans |
42
+ | **TLS fingerprint** | Real device (curl_cffi) | N/A | Browser detected |
43
+ | **Signing** | Full stack (Gorgon + Argus + Ladon + Guard) | N/A | None |
44
+
45
+ ---
46
+
47
+ ## How It Works
48
+
49
+ ```mermaid
50
+ flowchart LR
51
+ A["Your Code"] -->|"api.feed.for_you()"| B["tiktok-private-api\n(SDK)"]
52
+ B -->|"POST /v1/sign"| C["Signing Server\n(cloud)"]
53
+ C -->|"signed headers"| B
54
+ B -->|"GET /aweme/v1/feed/"| D["TikTok\nServers"]
55
+ D -->|"JSON response"| B
56
+ B -->|"parsed data"| A
57
+
58
+ style C fill:#1a1a2e,stroke:#e94560,color:#fff
59
+ style D fill:#1a1a2e,stroke:#00d2ff,color:#fff
60
+ ```
61
+
62
+ - **Your IP → TikTok directly.** The signing server only computes cryptographic headers.
63
+ - It never sees TikTok's responses or your data.
64
+ - Full signing stack: X-Gorgon, X-Argus, X-Ladon, ECDSA Device Guard, Ticket Guard.
65
+
66
+ ---
67
+
68
+ ## Endpoints
69
+
70
+ ### Feed
71
+ | Method | Description |
72
+ |--------|-------------|
73
+ | `api.feed.for_you()` | For You page |
74
+ | `api.feed.following()` | Following feed |
75
+ | `api.feed.user_posts(sec_user_id)` | User's videos |
76
+ | `api.feed.hashtag(ch_id)` | Hashtag feed |
77
+ | `api.feed.music(music_id)` | Music/sound feed |
78
+
79
+ ### User
80
+ | Method | Description |
81
+ |--------|-------------|
82
+ | `api.user.info(sec_user_id)` | User profile |
83
+ | `api.user.profile_self()` | Own profile |
84
+ | `api.user.followers(sec_user_id)` | Follower list |
85
+ | `api.user.following(sec_user_id)` | Following list |
86
+ | `api.user.search(keyword)` | Search users |
87
+ | `api.user.block_list()` | Blocked users |
88
+
89
+ ### Video
90
+ | Method | Description |
91
+ |--------|-------------|
92
+ | `api.video.detail(aweme_id)` | Video info + stats |
93
+ | `api.video.multi_detail(ids)` | Batch video info |
94
+ | `api.video.my_posts()` | Own posted videos |
95
+ | `api.video.favorites()` | Liked videos |
96
+ | `api.video.delete(aweme_id)` | Delete own video |
97
+
98
+ ### Social Actions
99
+ | Method | Description |
100
+ |--------|-------------|
101
+ | `api.social.like(aweme_id)` | Like a video |
102
+ | `api.social.unlike(aweme_id)` | Unlike |
103
+ | `api.social.follow(user_id)` | Follow a user |
104
+ | `api.social.unfollow(user_id)` | Unfollow |
105
+ | `api.social.block(user_id)` | Block a user |
106
+ | `api.social.unblock(user_id)` | Unblock |
107
+
108
+ ### Comments
109
+ | Method | Description |
110
+ |--------|-------------|
111
+ | `api.comment.list(aweme_id)` | Get comments |
112
+ | `api.comment.replies(comment_id)` | Get replies |
113
+ | `api.comment.publish(aweme_id, text)` | Post comment |
114
+ | `api.comment.delete(comment_id)` | Delete comment |
115
+ | `api.comment.like(comment_id)` | Like comment |
116
+
117
+ ### Search
118
+ | Method | Description |
119
+ |--------|-------------|
120
+ | `api.search.general(keyword)` | General search |
121
+ | `api.search.users(keyword)` | Search users |
122
+ | `api.search.videos(keyword)` | Search videos |
123
+ | `api.search.music(keyword)` | Search music |
124
+ | `api.search.hashtags(keyword)` | Search hashtags |
125
+ | `api.search.live(keyword)` | Search lives |
126
+
127
+ ### Music
128
+ | Method | Description |
129
+ |--------|-------------|
130
+ | `api.music.detail(music_id)` | Music/sound info |
131
+ | `api.music.videos(music_id)` | Videos using sound |
132
+
133
+ ### Direct Messages
134
+ | Method | Description |
135
+ |--------|-------------|
136
+ | `api.dm.conversations()` | Conversation list |
137
+ | `api.dm.messages(conversation_id)` | Read messages |
138
+ | `api.dm.unread_count()` | Unread count |
139
+
140
+ ### Live
141
+ | Method | Description |
142
+ |--------|-------------|
143
+ | `api.live.search(keyword)` | Search live streams |
144
+ | `api.live.enter(room_id)` | Enter live room |
145
+
146
+ ### Account
147
+ | Method | Description |
148
+ |--------|-------------|
149
+ | `api.passport.email_login(email, pw)` | Email login |
150
+ | `api.passport.sms_login(phone, code)` | SMS login |
151
+ | `api.passport.register(email, pw)` | Register account |
152
+ | `api.passport.logout()` | Logout |
153
+
154
+ ---
155
+
156
+ ## Setup
157
+
158
+ ### 1. Install
159
+
160
+ ```bash
161
+ pip install tiktok-private-api
162
+ ```
163
+
164
+ ### 2. Get an API key
165
+
166
+ Write me on Telegram — [@mxmtkchk](https://t.me/mxmtkchk).
167
+
168
+ Free keys available for testing. Paid plans for production use.
169
+
170
+ ### 3. Use
171
+
172
+ ```python
173
+ from tiktokflow import TikTokAPI
174
+
175
+ api = TikTokAPI(api_key="sk_your_key_here")
176
+
177
+ feed = api.feed.for_you(count=5)
178
+ print(f"Got {len(feed['aweme_list'])} videos")
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Advanced Usage
184
+
185
+ ### Proxy rotation
186
+
187
+ ```python
188
+ api = TikTokAPI(
189
+ api_key="sk_...",
190
+ proxies=["socks5://user:pass@proxy1:1080", "socks5://user:pass@proxy2:1080"],
191
+ proxy_rotate="round_robin", # or "random"
192
+ )
193
+ ```
194
+
195
+ ### iOS device fingerprint
196
+
197
+ ```python
198
+ api = TikTokAPI(api_key="sk_...", platform="ios")
199
+ ```
200
+
201
+ ### Rate limiting
202
+
203
+ ```python
204
+ api = TikTokAPI(api_key="sk_...", rate_limit=2.0) # max 2 req/sec
205
+ ```
206
+
207
+ ### Session persistence
208
+
209
+ ```python
210
+ api.device.save("my_session.json")
211
+
212
+ # Later:
213
+ from tiktokflow.android import Device
214
+ device = Device.load("my_session.json")
215
+ api = TikTokAPI(api_key="sk_...", device=device)
216
+ ```
217
+
218
+ ### Async
219
+
220
+ ```python
221
+ from tiktokflow.android import AsyncAndroidClient, Device, RemoteSigner
222
+
223
+ signer = RemoteSigner("http://...", "sk_...")
224
+ async with AsyncAndroidClient(Device(), signer=signer) as api:
225
+ feed = await api.feed.for_you(count=10)
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Examples
231
+
232
+ See [examples/](examples/):
233
+
234
+ - [`quickstart.py`](examples/quickstart.py) — Feed + user lookup + like
235
+ - [`bulk_scraper.py`](examples/bulk_scraper.py) — Scrape videos with pagination
236
+
237
+ ---
238
+
239
+ ## SDK vs Competitors
240
+
241
+ | Feature | tiktok-private-api | TikTok-Api (davidteather) | tiktok-scraper |
242
+ |---------|-------------------|--------------------------|----------------|
243
+ | Write endpoints | **Yes** (like, follow, comment) | No | No |
244
+ | Mobile signing | **Full** (Gorgon+Argus+Ladon+Guard) | Partial (browser) | None |
245
+ | Android + iOS | **Yes** | No | No |
246
+ | Proxy rotation | **Built-in** | Manual | Manual |
247
+ | DM access | **Yes** | No | No |
248
+ | Account login | **Yes** | No | No |
249
+ | Maintained | **Yes (2026)** | Sporadic | Archived |
250
+ | Anti-detection | **TLS impersonation** | Browser automation | HTTP only |
251
+
252
+ ---
253
+
254
+ ## Contributing
255
+
256
+ Contributions welcome! Open an issue first to discuss.
257
+
258
+ ## Contact
259
+
260
+ **Telegram:** [@mxmtkchk](https://t.me/mxmtkchk) — support, API keys, feature requests
261
+
262
+ ## License
263
+
264
+ MIT. See [LICENSE](LICENSE).
265
+
266
+ ---
267
+
268
+ *This project is not affiliated with TikTok or ByteDance. Use responsibly.*
@@ -0,0 +1,46 @@
1
+ """Scrape all videos from multiple users."""
2
+ import json
3
+ import time
4
+ from tiktokflow import TikTokAPI
5
+
6
+ api = TikTokAPI(api_key="sk_your_key_here", rate_limit=2.0)
7
+
8
+ USERS = [
9
+ "MS4wLjABAAAA...", # user 1 sec_user_id
10
+ "MS4wLjABAAAA...", # user 2 sec_user_id
11
+ ]
12
+
13
+
14
+ def scrape_user_videos(sec_user_id: str) -> list[dict]:
15
+ """Fetch all videos from a user, paginating through results."""
16
+ all_videos = []
17
+ cursor = 0
18
+
19
+ while True:
20
+ result = api.video.my_posts(
21
+ sec_user_id=sec_user_id,
22
+ max_cursor=cursor,
23
+ count=20,
24
+ )
25
+ videos = result.get("aweme_list", [])
26
+ if not videos:
27
+ break
28
+
29
+ all_videos.extend(videos)
30
+ print(f" Fetched {len(all_videos)} videos...")
31
+
32
+ if not result.get("has_more"):
33
+ break
34
+ cursor = result.get("max_cursor", 0)
35
+ time.sleep(0.5)
36
+
37
+ return all_videos
38
+
39
+
40
+ for sec_uid in USERS:
41
+ print(f"\nScraping {sec_uid[:20]}...")
42
+ videos = scrape_user_videos(sec_uid)
43
+ print(f" Total: {len(videos)} videos")
44
+
45
+ with open(f"videos_{sec_uid[:10]}.json", "w") as f:
46
+ json.dump(videos, f, indent=2)
@@ -0,0 +1,21 @@
1
+ """Quick start example — feed + user lookup + like."""
2
+ from tiktokflow import TikTokAPI
3
+
4
+ api = TikTokAPI(api_key="sk_your_key_here")
5
+
6
+ # 1. Get trending feed
7
+ feed = api.feed.for_you(count=5)
8
+ for video in feed["aweme_list"]:
9
+ desc = video.get("desc", "")[:50]
10
+ likes = video["statistics"]["digg_count"]
11
+ print(f" {desc}... ({likes:,} likes)")
12
+
13
+ # 2. Look up a user
14
+ user = api.user.info(sec_user_id="MS4wLjABAAAA...")
15
+ profile = user["user"]
16
+ print(f"\n@{profile['unique_id']}: {profile['follower_count']:,} followers")
17
+
18
+ # 3. Like the first video
19
+ first_video = feed["aweme_list"][0]
20
+ api.social.like(aweme_id=first_video["aweme_id"])
21
+ print(f"\nLiked: {first_video['aweme_id']}")