Skip to main content

Python client for zefoy.com — JSON-only API (login, services, send views/hearts/...)

Project description

zefoy-client

Python client library for zefoy.com.

  • JSON-only API — every public method returns a dict (ready for json.dumps)
  • No stdout noise from the library
  • Captcha via ddddocr (optional manual captcha)
  • Auto cooldown wait (IP-based server timer)
  • Services: views, hearts, favorites, shares, followers, …

Disclaimer: Unofficial. Use at your own risk. Respect site terms and local laws. For educational / automation research purposes.


Install

PyPI

pip install zefoy-client

Optional extras:

pip install "zefoy-client[socks]"   # SOCKS4/5 proxy
pip install "zefoy-client[ocr]"     # pytesseract helper
pip install "zefoy-client[socks,ocr]"

GitHub

Repo: https://github.com/deno4908/zefoy_lib

# latest main
pip install git+https://github.com/deno4908/zefoy_lib.git

# specific branch / tag
pip install git+https://github.com/deno4908/zefoy_lib.git@main
pip install git+https://github.com/deno4908/zefoy_lib.git@v0.1.0

Clone rồi cài editable (dev):

git clone https://github.com/deno4908/zefoy_lib.git
cd zefoy_lib
pip install -e .
# pip install -e ".[socks,ocr]"

From local folder

cd zefoy-client
pip install -e .

Build / publish wheel

pip install build twine
python -m build
twine check dist/*
# twine upload dist/*

Quick start

import json
from zefoy import Zefoy

bot = Zefoy(
    use_ocr=True,       # solve captcha with ddddocr
    auto_wait=True,     # sleep on server cooldown
    # proxy="http://user:pass@host:port",
)

print(json.dumps(bot.login(), ensure_ascii=False, indent=2))
print(json.dumps(bot.services(), ensure_ascii=False, indent=2))

url = "https://www.tiktok.com/@user/video/1234567890"
print(json.dumps(bot.send_views(url), ensure_ascii=False, indent=2))

Proxy

proxy áp dụng cho toàn session (login + captcha + services + send).
Hỗ trợ URL string hoặc dict kiểu requests.

Loại Ví dụ
HTTP http://host:8080
HTTP + auth http://user:pass@host:8080
HTTPS proxy https://user:pass@host:8443
SOCKS5 socks5://user:pass@host:1080
SOCKS5h (DNS qua proxy) socks5h://user:pass@host:1080
SOCKS4 socks4://host:1080
# SOCKS cần thêm dependency
pip install -e ".[socks]"
# hoặc: pip install PySocks requests[socks]
from zefoy import Zefoy
import json

# 1) HTTP proxy (string — gán cả http & https)
bot = Zefoy(proxy="http://1.2.3.4:8080")

# 2) HTTP có user/pass
bot = Zefoy(proxy="http://myuser:mypass@1.2.3.4:8080")

# 3) SOCKS5
bot = Zefoy(proxy="socks5://user:pass@1.2.3.4:1080")

# 4) SOCKS5 + resolve DNS trên proxy
bot = Zefoy(proxy="socks5h://user:pass@1.2.3.4:1080")

# 5) Dict tách http / https (giống requests)
bot = Zefoy(proxy={
    "http": "http://user:pass@1.2.3.4:8080",
    "https": "http://user:pass@1.2.3.4:8080",
})

# 6) Dùng với send
url = "https://www.tiktok.com/@user/video/123"
print(json.dumps(bot.login(), ensure_ascii=False, indent=2))
print(json.dumps(bot.send_views(url), ensure_ascii=False, indent=2))
print(json.dumps(bot.send_hearts(url), ensure_ascii=False, indent=2))

CLI:

zefoy --proxy "http://user:pass@host:8080" send views "https://www.tiktok.com/@u/video/123"
zefoy --proxy "socks5h://user:pass@host:1080" send hearts "https://..."

Proxy đổi IP → tránh / giảm cooldown theo IP của Zefoy. Proxy chết sẽ làm login/send trả ok: false.

Manual captcha

bot = Zefoy(use_ocr=False)
img = bot.get_captcha_image("captcha.png")  # open image yourself
print(bot.login(captcha_text="flower"))

Custom captcha solver

def my_solver(image):
    # image: PIL.Image
    return "answer"

bot = Zefoy(captcha_solver=my_solver)
bot.login()

API

Zefoy(...)

Arg Type Default Description
use_ocr bool True Auto-solve captcha
auto_wait bool True Wait on IP cooldown
max_cooldown_retries int 5 Max wait/retry loops
proxy str | dict None Proxy URL hoặc dict requests (HTTP/HTTPS/SOCKS)
captcha_solver callable None f(PIL.Image) -> str
user_agent str Chrome 131 Must stay consistent per session
on_event callable None Optional debug hook f(dict)

Methods (all return dict)

Method Description
login(captcha_text=None, max_tries=5) Captcha + session
submit_captcha(text) Submit captcha only
services() / get_services() List available services
send(service, url) Search + send order
send_views(url) Shortcut
send_hearts(url) Shortcut
send_favorites(url) Shortcut
send_shares(url) Shortcut
send_followers(url) Shortcut
Zefoy.to_json(data) json.dumps helper

service name examples: "views", "t-views", "hearts", "favorites", …


Response shape

Every call looks like:

{
  "ok": true,
  "...": "..."
}

login() success

{
  "ok": true,
  "status": "logged_in",
  "captcha": "flower",
  "attempts": []
}

services() success

{
  "ok": true,
  "count": 8,
  "services": [
    {
      "name": "t-views",
      "disabled": false,
      "action": "https://zefoy.com/c2VuZC9mb2xeb3dlcnNfdGlrdG9V"
    }
  ]
}

send_views() success

{
  "ok": true,
  "status": "sent",
  "service": "t-views",
  "target": "https://www.tiktok.com/@u/video/123",
  "video_id": "123",
  "zefoy_amount": 1000,
  "zefoy_amount_label": "1000 views",
  "wait_seconds": 552,
  "summary": "sent 1000 views | next_wait 552s"
}

Note: zefoy_amount is decided by Zefoy, not by the caller.

Error

{
  "ok": false,
  "error": "cooldown",
  "wait_seconds": 91,
  "message": "Please wait 91 seconds before trying again."
}

Common error codes: login_failed, captcha_rejected, cooldown, service_not_found, no_send_form, send_failed, max_retries.


CLI

After install:

zefoy login
zefoy services
zefoy send views "https://www.tiktok.com/@u/video/123"

Or:

python -m zefoy send views "https://..."

Flow (internal)

  1. Login — fetch captcha image → OCR/manual → POST captchalogin + encrypted fingerprint
  2. SearchPOST /{base64_action} with HASH=full_tiktok_url
  3. SendPOST same endpoint with HASH=video_id
  4. Response body is reverse + base64 (same as site JS)

Server cooldown is IP-based, not local-session-based. New process on same IP still waits.


Project layout

zefoy-client/
├── pyproject.toml
├── README.md
├── LICENSE
├── MANIFEST.in
├── examples/
│   └── basic.py
└── src/
    └── zefoy/
        ├── __init__.py
        ├── __main__.py
        └── client.py

Publish to PyPI

python -m build
twine check dist/*
twine upload dist/*

Users install with:

pip install zefoy-client
# or from GitHub:
pip install git+https://github.com/deno4908/zefoy_lib.git

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zefoy_client-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zefoy_client-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file zefoy_client-0.1.0.tar.gz.

File metadata

  • Download URL: zefoy_client-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for zefoy_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f6b56adcc1cb4b2ba04e95a0ac222245787b68ca98404c72dcf2fce971057dc
MD5 5c7dcb72bcb39f5308db90afe890a10a
BLAKE2b-256 34bc902722f76433755a39949ad1bfc7a89e05de470e54798937c47743fd5241

See more details on using hashes here.

File details

Details for the file zefoy_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zefoy_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for zefoy_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4584d327763217bc3e673a486347b7fad398f0ca6471b07a808a280feae0a96
MD5 383a8c539f1200d90a0ce1cc5c2e45aa
BLAKE2b-256 a2eb7b06217d55f496b1554ef646ac4cb10aa65b5d1ba1c2a303c5c5491323a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page