zefoy-client 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.
- zefoy_client-0.1.0/LICENSE +21 -0
- zefoy_client-0.1.0/MANIFEST.in +5 -0
- zefoy_client-0.1.0/PKG-INFO +384 -0
- zefoy_client-0.1.0/README.md +341 -0
- zefoy_client-0.1.0/examples/basic.py +10 -0
- zefoy_client-0.1.0/examples/proxy_example.py +13 -0
- zefoy_client-0.1.0/pyproject.toml +55 -0
- zefoy_client-0.1.0/setup.cfg +4 -0
- zefoy_client-0.1.0/src/zefoy/__init__.py +28 -0
- zefoy_client-0.1.0/src/zefoy/__main__.py +72 -0
- zefoy_client-0.1.0/src/zefoy/client.py +896 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/PKG-INFO +384 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/SOURCES.txt +15 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/dependency_links.txt +1 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/entry_points.txt +2 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/requires.txt +20 -0
- zefoy_client-0.1.0/src/zefoy_client.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zefoy-client contributors
|
|
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,384 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zefoy-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client for zefoy.com — JSON-only API (login, services, send views/hearts/...)
|
|
5
|
+
Author: zefoy-client contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/deno4908/zefoy_lib
|
|
8
|
+
Project-URL: Repository, https://github.com/deno4908/zefoy_lib
|
|
9
|
+
Project-URL: Issues, https://github.com/deno4908/zefoy_lib/issues
|
|
10
|
+
Keywords: zefoy,tiktok,automation,api,client
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: cloudscraper>=1.2.71
|
|
26
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
27
|
+
Requires-Dist: Pillow>=10.0.0
|
|
28
|
+
Requires-Dist: numpy>=1.24.0
|
|
29
|
+
Requires-Dist: ddddocr>=1.4.11
|
|
30
|
+
Requires-Dist: pycryptodome>=3.19.0
|
|
31
|
+
Requires-Dist: brotli>=1.1.0
|
|
32
|
+
Requires-Dist: requests>=2.31.0
|
|
33
|
+
Provides-Extra: ocr
|
|
34
|
+
Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
|
|
35
|
+
Provides-Extra: socks
|
|
36
|
+
Requires-Dist: PySocks>=1.7.1; extra == "socks"
|
|
37
|
+
Requires-Dist: requests[socks]>=2.31.0; extra == "socks"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: build; extra == "dev"
|
|
40
|
+
Requires-Dist: twine; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# zefoy-client
|
|
45
|
+
|
|
46
|
+
Python client library for [zefoy.com](https://zefoy.com).
|
|
47
|
+
|
|
48
|
+
- **JSON-only API** — every public method returns a `dict` (ready for `json.dumps`)
|
|
49
|
+
- No stdout noise from the library
|
|
50
|
+
- Captcha via **ddddocr** (optional manual captcha)
|
|
51
|
+
- Auto cooldown wait (IP-based server timer)
|
|
52
|
+
- Services: views, hearts, favorites, shares, followers, …
|
|
53
|
+
|
|
54
|
+
> **Disclaimer:** Unofficial. Use at your own risk. Respect site terms and local laws. For educational / automation research purposes.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
### PyPI
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install zefoy-client
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Optional extras:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install "zefoy-client[socks]" # SOCKS4/5 proxy
|
|
70
|
+
pip install "zefoy-client[ocr]" # pytesseract helper
|
|
71
|
+
pip install "zefoy-client[socks,ocr]"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### GitHub
|
|
75
|
+
|
|
76
|
+
Repo: [https://github.com/deno4908/zefoy_lib](https://github.com/deno4908/zefoy_lib)
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# latest main
|
|
80
|
+
pip install git+https://github.com/deno4908/zefoy_lib.git
|
|
81
|
+
|
|
82
|
+
# specific branch / tag
|
|
83
|
+
pip install git+https://github.com/deno4908/zefoy_lib.git@main
|
|
84
|
+
pip install git+https://github.com/deno4908/zefoy_lib.git@v0.1.0
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Clone rồi cài editable (dev):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/deno4908/zefoy_lib.git
|
|
91
|
+
cd zefoy_lib
|
|
92
|
+
pip install -e .
|
|
93
|
+
# pip install -e ".[socks,ocr]"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### From local folder
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd zefoy-client
|
|
100
|
+
pip install -e .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Build / publish wheel
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install build twine
|
|
107
|
+
python -m build
|
|
108
|
+
twine check dist/*
|
|
109
|
+
# twine upload dist/*
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Quick start
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import json
|
|
118
|
+
from zefoy import Zefoy
|
|
119
|
+
|
|
120
|
+
bot = Zefoy(
|
|
121
|
+
use_ocr=True, # solve captcha with ddddocr
|
|
122
|
+
auto_wait=True, # sleep on server cooldown
|
|
123
|
+
# proxy="http://user:pass@host:port",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
print(json.dumps(bot.login(), ensure_ascii=False, indent=2))
|
|
127
|
+
print(json.dumps(bot.services(), ensure_ascii=False, indent=2))
|
|
128
|
+
|
|
129
|
+
url = "https://www.tiktok.com/@user/video/1234567890"
|
|
130
|
+
print(json.dumps(bot.send_views(url), ensure_ascii=False, indent=2))
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Proxy
|
|
134
|
+
|
|
135
|
+
`proxy` áp dụng cho **toàn session** (login + captcha + services + send).
|
|
136
|
+
Hỗ trợ URL string hoặc dict kiểu `requests`.
|
|
137
|
+
|
|
138
|
+
| Loại | Ví dụ |
|
|
139
|
+
|------|--------|
|
|
140
|
+
| HTTP | `http://host:8080` |
|
|
141
|
+
| HTTP + auth | `http://user:pass@host:8080` |
|
|
142
|
+
| HTTPS proxy | `https://user:pass@host:8443` |
|
|
143
|
+
| SOCKS5 | `socks5://user:pass@host:1080` |
|
|
144
|
+
| SOCKS5h (DNS qua proxy) | `socks5h://user:pass@host:1080` |
|
|
145
|
+
| SOCKS4 | `socks4://host:1080` |
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# SOCKS cần thêm dependency
|
|
149
|
+
pip install -e ".[socks]"
|
|
150
|
+
# hoặc: pip install PySocks requests[socks]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
from zefoy import Zefoy
|
|
155
|
+
import json
|
|
156
|
+
|
|
157
|
+
# 1) HTTP proxy (string — gán cả http & https)
|
|
158
|
+
bot = Zefoy(proxy="http://1.2.3.4:8080")
|
|
159
|
+
|
|
160
|
+
# 2) HTTP có user/pass
|
|
161
|
+
bot = Zefoy(proxy="http://myuser:mypass@1.2.3.4:8080")
|
|
162
|
+
|
|
163
|
+
# 3) SOCKS5
|
|
164
|
+
bot = Zefoy(proxy="socks5://user:pass@1.2.3.4:1080")
|
|
165
|
+
|
|
166
|
+
# 4) SOCKS5 + resolve DNS trên proxy
|
|
167
|
+
bot = Zefoy(proxy="socks5h://user:pass@1.2.3.4:1080")
|
|
168
|
+
|
|
169
|
+
# 5) Dict tách http / https (giống requests)
|
|
170
|
+
bot = Zefoy(proxy={
|
|
171
|
+
"http": "http://user:pass@1.2.3.4:8080",
|
|
172
|
+
"https": "http://user:pass@1.2.3.4:8080",
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
# 6) Dùng với send
|
|
176
|
+
url = "https://www.tiktok.com/@user/video/123"
|
|
177
|
+
print(json.dumps(bot.login(), ensure_ascii=False, indent=2))
|
|
178
|
+
print(json.dumps(bot.send_views(url), ensure_ascii=False, indent=2))
|
|
179
|
+
print(json.dumps(bot.send_hearts(url), ensure_ascii=False, indent=2))
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
CLI:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
zefoy --proxy "http://user:pass@host:8080" send views "https://www.tiktok.com/@u/video/123"
|
|
186
|
+
zefoy --proxy "socks5h://user:pass@host:1080" send hearts "https://..."
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
> Proxy đổi IP → tránh / giảm cooldown theo IP của Zefoy. Proxy chết sẽ làm `login`/`send` trả `ok: false`.
|
|
190
|
+
|
|
191
|
+
### Manual captcha
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
bot = Zefoy(use_ocr=False)
|
|
195
|
+
img = bot.get_captcha_image("captcha.png") # open image yourself
|
|
196
|
+
print(bot.login(captcha_text="flower"))
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Custom captcha solver
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
def my_solver(image):
|
|
203
|
+
# image: PIL.Image
|
|
204
|
+
return "answer"
|
|
205
|
+
|
|
206
|
+
bot = Zefoy(captcha_solver=my_solver)
|
|
207
|
+
bot.login()
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## API
|
|
213
|
+
|
|
214
|
+
### `Zefoy(...)`
|
|
215
|
+
|
|
216
|
+
| Arg | Type | Default | Description |
|
|
217
|
+
|-----|------|---------|-------------|
|
|
218
|
+
| `use_ocr` | `bool` | `True` | Auto-solve captcha |
|
|
219
|
+
| `auto_wait` | `bool` | `True` | Wait on IP cooldown |
|
|
220
|
+
| `max_cooldown_retries` | `int` | `5` | Max wait/retry loops |
|
|
221
|
+
| `proxy` | `str` \| `dict` | `None` | Proxy URL hoặc dict `requests` (HTTP/HTTPS/SOCKS) |
|
|
222
|
+
| `captcha_solver` | `callable` | `None` | `f(PIL.Image) -> str` |
|
|
223
|
+
| `user_agent` | `str` | Chrome 131 | Must stay consistent per session |
|
|
224
|
+
| `on_event` | `callable` | `None` | Optional debug hook `f(dict)` |
|
|
225
|
+
|
|
226
|
+
### Methods (all return `dict`)
|
|
227
|
+
|
|
228
|
+
| Method | Description |
|
|
229
|
+
|--------|-------------|
|
|
230
|
+
| `login(captcha_text=None, max_tries=5)` | Captcha + session |
|
|
231
|
+
| `submit_captcha(text)` | Submit captcha only |
|
|
232
|
+
| `services()` / `get_services()` | List available services |
|
|
233
|
+
| `send(service, url)` | Search + send order |
|
|
234
|
+
| `send_views(url)` | Shortcut |
|
|
235
|
+
| `send_hearts(url)` | Shortcut |
|
|
236
|
+
| `send_favorites(url)` | Shortcut |
|
|
237
|
+
| `send_shares(url)` | Shortcut |
|
|
238
|
+
| `send_followers(url)` | Shortcut |
|
|
239
|
+
| `Zefoy.to_json(data)` | `json.dumps` helper |
|
|
240
|
+
|
|
241
|
+
`service` name examples: `"views"`, `"t-views"`, `"hearts"`, `"favorites"`, …
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Response shape
|
|
246
|
+
|
|
247
|
+
Every call looks like:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"ok": true,
|
|
252
|
+
"...": "..."
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### `login()` success
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"ok": true,
|
|
261
|
+
"status": "logged_in",
|
|
262
|
+
"captcha": "flower",
|
|
263
|
+
"attempts": []
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### `services()` success
|
|
268
|
+
|
|
269
|
+
```json
|
|
270
|
+
{
|
|
271
|
+
"ok": true,
|
|
272
|
+
"count": 8,
|
|
273
|
+
"services": [
|
|
274
|
+
{
|
|
275
|
+
"name": "t-views",
|
|
276
|
+
"disabled": false,
|
|
277
|
+
"action": "https://zefoy.com/c2VuZC9mb2xeb3dlcnNfdGlrdG9V"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### `send_views()` success
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"ok": true,
|
|
288
|
+
"status": "sent",
|
|
289
|
+
"service": "t-views",
|
|
290
|
+
"target": "https://www.tiktok.com/@u/video/123",
|
|
291
|
+
"video_id": "123",
|
|
292
|
+
"zefoy_amount": 1000,
|
|
293
|
+
"zefoy_amount_label": "1000 views",
|
|
294
|
+
"wait_seconds": 552,
|
|
295
|
+
"summary": "sent 1000 views | next_wait 552s"
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
> **Note:** `zefoy_amount` is decided by Zefoy, not by the caller.
|
|
300
|
+
|
|
301
|
+
### Error
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"ok": false,
|
|
306
|
+
"error": "cooldown",
|
|
307
|
+
"wait_seconds": 91,
|
|
308
|
+
"message": "Please wait 91 seconds before trying again."
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Common `error` codes: `login_failed`, `captcha_rejected`, `cooldown`, `service_not_found`, `no_send_form`, `send_failed`, `max_retries`.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## CLI
|
|
317
|
+
|
|
318
|
+
After install:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
zefoy login
|
|
322
|
+
zefoy services
|
|
323
|
+
zefoy send views "https://www.tiktok.com/@u/video/123"
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Or:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
python -m zefoy send views "https://..."
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Flow (internal)
|
|
335
|
+
|
|
336
|
+
1. **Login** — fetch captcha image → OCR/manual → POST `captchalogin` + encrypted fingerprint
|
|
337
|
+
2. **Search** — `POST /{base64_action}` with `HASH=full_tiktok_url`
|
|
338
|
+
3. **Send** — `POST` same endpoint with `HASH=video_id`
|
|
339
|
+
4. Response body is `reverse + base64` (same as site JS)
|
|
340
|
+
|
|
341
|
+
Server cooldown is **IP-based**, not local-session-based. New process on same IP still waits.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Project layout
|
|
346
|
+
|
|
347
|
+
```text
|
|
348
|
+
zefoy-client/
|
|
349
|
+
├── pyproject.toml
|
|
350
|
+
├── README.md
|
|
351
|
+
├── LICENSE
|
|
352
|
+
├── MANIFEST.in
|
|
353
|
+
├── examples/
|
|
354
|
+
│ └── basic.py
|
|
355
|
+
└── src/
|
|
356
|
+
└── zefoy/
|
|
357
|
+
├── __init__.py
|
|
358
|
+
├── __main__.py
|
|
359
|
+
└── client.py
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Publish to PyPI
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
python -m build
|
|
368
|
+
twine check dist/*
|
|
369
|
+
twine upload dist/*
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Users install with:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
pip install zefoy-client
|
|
376
|
+
# or from GitHub:
|
|
377
|
+
pip install git+https://github.com/deno4908/zefoy_lib.git
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## License
|
|
383
|
+
|
|
384
|
+
MIT
|