zefoy-client 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.
zefoy/__init__.py ADDED
@@ -0,0 +1,28 @@
1
+ """
2
+ zefoy — Python client for zefoy.com (JSON-only API).
3
+
4
+ Example:
5
+ from zefoy import Zefoy
6
+ import json
7
+
8
+ bot = Zefoy()
9
+ print(json.dumps(bot.login()))
10
+ print(json.dumps(bot.services()))
11
+ print(json.dumps(bot.send_views("https://www.tiktok.com/@u/video/123")))
12
+ """
13
+
14
+ from .client import (
15
+ Zefoy,
16
+ decode_zefoy_response,
17
+ encrypt_aes_json,
18
+ extract_video_id,
19
+ )
20
+
21
+ __version__ = "0.1.0"
22
+ __all__ = [
23
+ "Zefoy",
24
+ "extract_video_id",
25
+ "decode_zefoy_response",
26
+ "encrypt_aes_json",
27
+ "__version__",
28
+ ]
zefoy/__main__.py ADDED
@@ -0,0 +1,72 @@
1
+ """python -m zefoy"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import sys
8
+
9
+ from . import Zefoy, __version__
10
+
11
+
12
+ def jprint(data):
13
+ print(json.dumps(data, ensure_ascii=False, indent=2, default=str))
14
+
15
+
16
+ def main(argv=None) -> int:
17
+ parser = argparse.ArgumentParser(prog="zefoy", description="Zefoy JSON client CLI")
18
+ parser.add_argument("--version", action="version", version="zefoy " + __version__)
19
+ parser.add_argument("--proxy", default=None, help="http://user:pass@host:port")
20
+ parser.add_argument("--no-ocr", action="store_true", help="disable OCR captcha solve")
21
+ parser.add_argument("--no-wait", action="store_true", help="do not auto-wait cooldown")
22
+ sub = parser.add_subparsers(dest="cmd", required=True)
23
+
24
+ p_login = sub.add_parser("login", help="solve captcha and login")
25
+ p_login.add_argument("--captcha", default=None, help="manual captcha text")
26
+
27
+ sub.add_parser("services", help="list services (requires login session in-process)")
28
+
29
+ p_send = sub.add_parser("send", help="login + send order")
30
+ p_send.add_argument("service", help="views | hearts | favorites | shares | followers | t-views ...")
31
+ p_send.add_argument("url", help="TikTok video URL or id")
32
+ p_send.add_argument("--captcha", default=None)
33
+
34
+ args = parser.parse_args(argv)
35
+
36
+ try:
37
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
38
+ except Exception:
39
+ pass
40
+
41
+ bot = Zefoy(
42
+ use_ocr=not args.no_ocr,
43
+ auto_wait=not args.no_wait,
44
+ proxy=args.proxy,
45
+ )
46
+
47
+ if args.cmd == "login":
48
+ jprint(bot.login(captcha_text=args.captcha))
49
+ return 0
50
+
51
+ if args.cmd == "services":
52
+ r = bot.login()
53
+ if not r.get("ok"):
54
+ jprint(r)
55
+ return 1
56
+ jprint(bot.services())
57
+ return 0
58
+
59
+ if args.cmd == "send":
60
+ r = bot.login(captcha_text=args.captcha)
61
+ if not r.get("ok"):
62
+ jprint({"login": r})
63
+ return 1
64
+ out = bot.send(args.service, args.url)
65
+ jprint({"login": r, "send": out})
66
+ return 0 if out.get("ok") else 2
67
+
68
+ return 1
69
+
70
+
71
+ if __name__ == "__main__":
72
+ raise SystemExit(main())