sni-cli 1.2.2__tar.gz → 1.2.4__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 (45) hide show
  1. {sni_cli-1.2.2 → sni_cli-1.2.4}/PKG-INFO +18 -14
  2. {sni_cli-1.2.2 → sni_cli-1.2.4}/README.md +17 -13
  3. {sni_cli-1.2.2 → sni_cli-1.2.4}/pyproject.toml +1 -1
  4. sni_cli-1.2.4/sni/__init__.py +1 -0
  5. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/cli.py +9 -10
  6. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/allanime.py +8 -2
  7. sni_cli-1.2.4/worker/README.md +133 -0
  8. sni_cli-1.2.2/sni/__init__.py +0 -1
  9. {sni_cli-1.2.2 → sni_cli-1.2.4}/.gitignore +0 -0
  10. {sni_cli-1.2.2 → sni_cli-1.2.4}/LICENSE +0 -0
  11. {sni_cli-1.2.2 → sni_cli-1.2.4}/install.ps1 +0 -0
  12. {sni_cli-1.2.2 → sni_cli-1.2.4}/install.sh +0 -0
  13. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/__main__.py +0 -0
  14. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/config.py +0 -0
  15. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/exceptions.py +0 -0
  16. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/logger.py +0 -0
  17. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/player.py +0 -0
  18. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/__init__.py +0 -0
  19. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/base.py +0 -0
  20. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/cache.py +0 -0
  21. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/extractors/__init__.py +0 -0
  22. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/extractors/megacloud.py +0 -0
  23. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/extractors/vixcloud.py +0 -0
  24. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/providers/registry.py +0 -0
  25. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/__init__.py +0 -0
  26. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/app.py +0 -0
  27. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/bridge.py +0 -0
  28. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/screens/__init__.py +0 -0
  29. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/screens/help.py +0 -0
  30. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/screens/history.py +0 -0
  31. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/screens/home.py +0 -0
  32. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/screens/player.py +0 -0
  33. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/widgets/__init__.py +0 -0
  34. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/widgets/ascii_art.py +0 -0
  35. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/tui/widgets/info_box.py +0 -0
  36. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/ui.py +0 -0
  37. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/watch_history.py +0 -0
  38. {sni_cli-1.2.2 → sni_cli-1.2.4}/sni/wizard.py +0 -0
  39. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/__init__.py +0 -0
  40. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/conftest.py +0 -0
  41. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/test_allanime_captcha.py +0 -0
  42. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/test_cache.py +0 -0
  43. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/test_config.py +0 -0
  44. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/test_exceptions.py +0 -0
  45. {sni_cli-1.2.2 → sni_cli-1.2.4}/tests/test_providers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sni-cli
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Stream Ninja Interface — terminal-based anime streaming CLI + TUI
5
5
  Project-URL: Homepage, https://github.com/sundeepyt2/SNI
6
6
  Project-URL: Source, https://github.com/sundeepyt2/SNI
@@ -380,26 +380,30 @@ echo 'cf_clearance=...;' > ~/.config/sni/allanime_cookies.txt
380
380
  sni play "one piece" --cookie 'cf_clearance=...;'
381
381
  ```
382
382
 
383
- ### Option 2 — Cloudflare Worker (last resort for VPN/shared IPs that are permanently captcha-walled AND cookies + public proxies don't work)
383
+ ### Option 2 — Self-hosted proxy worker (last resort for VPN/shared IPs that are permanently captcha-walled AND cookies + public proxies don't work)
384
384
 
385
- This is the most powerful bypass it proxies AllAnime API requests through Cloudflare's own IPs, which AllAnime rarely challenges. Only set this up if Option 1 fails AND SNI's built-in proxy fallback doesn't work for you.
385
+ SNI ships with ready-to-deploy proxy worker code in the [`worker/`](worker/) directory. The worker proxies AllAnime API requests through a clean IP (the platform's IP), which AllAnime's edge doesn't flag. **Three deployment platforms are supported all have free tiers, none require a credit card:**
386
386
 
387
- **Deploy via Cloudflare** (free, requires a Cloudflare account):
387
+ | Platform | Difficulty | Setup time | Why pick this |
388
+ |---|---|---|---|
389
+ | **Deno Deploy** | Easiest | ~2 min | Most reliable as of 2026; playground = no GitHub repo needed |
390
+ | **Vercel Edge Functions** | Easy | ~3 min | Good if you already use Vercel |
391
+ | **Cloudflare Workers** | Hard right now | ~5 min | Known dashboard deploy bugs; use only if others fail |
388
392
 
389
- 1. Go to https://dash.cloudflare.com Workers & Pages Create
390
- 2. Paste the contents of [`cf-worker/worker.js`](https://github.com/smithmx20/XAN/blob/main/cf-worker/worker.js) from the XAN repo
391
- 3. Deploy, copy the worker URL (e.g. `https://xan-proxy.you.workers.dev`)
392
- 4. Save it to SNI:
393
+ **Full step-by-step instructions for all three platforms are in [`worker/README.md`](worker/README.md).**
394
+
395
+ Quick Deno Deploy setup (recommended):
396
+
397
+ 1. Go to https://dash.deno.com → sign in with GitHub → "New Project" → "Playground"
398
+ 2. Paste the contents of [`worker/proxy.deno.js`](worker/proxy.deno.js) → click "Save & Deploy"
399
+ 3. Copy the URL (e.g. `https://your-project.deno.dev`)
400
+ 4. Save to SNI:
393
401
 
394
402
  ```bash
395
- sni config --update allanime_cf_worker_url='https://xan-proxy.you.workers.dev'
403
+ sni config --update allanime_cf_worker_url='https://your-project.deno.dev'
396
404
  ```
397
405
 
398
- **Can't create a Cloudflare account?** Deploy the same `worker.js` code to any of these alternative platforms (all have free tiers, none require a credit card):
399
-
400
- - **Deno Deploy** (https://dash.deno.com) — free, no card required, fastest setup. Wrap the worker's `fetch` handler in a `Deno.serve()` call.
401
- - **Vercel Edge Functions** (https://vercel.com) — free tier. Adapt the handler to Vercel's `export default function handler(req: Request)` signature.
402
- - **Netlify Functions** (https://netlify.com) — free tier. Convert to Netlify's `exports.handler` format.
406
+ 5. Try: `sni play "one piece"`
403
407
 
404
408
  The worker code is platform-agnostic — it's just a `fetch` handler that proxies a request. The only thing that changes between platforms is the entry-point wrapper.
405
409
 
@@ -327,26 +327,30 @@ echo 'cf_clearance=...;' > ~/.config/sni/allanime_cookies.txt
327
327
  sni play "one piece" --cookie 'cf_clearance=...;'
328
328
  ```
329
329
 
330
- ### Option 2 — Cloudflare Worker (last resort for VPN/shared IPs that are permanently captcha-walled AND cookies + public proxies don't work)
330
+ ### Option 2 — Self-hosted proxy worker (last resort for VPN/shared IPs that are permanently captcha-walled AND cookies + public proxies don't work)
331
331
 
332
- This is the most powerful bypass it proxies AllAnime API requests through Cloudflare's own IPs, which AllAnime rarely challenges. Only set this up if Option 1 fails AND SNI's built-in proxy fallback doesn't work for you.
332
+ SNI ships with ready-to-deploy proxy worker code in the [`worker/`](worker/) directory. The worker proxies AllAnime API requests through a clean IP (the platform's IP), which AllAnime's edge doesn't flag. **Three deployment platforms are supported all have free tiers, none require a credit card:**
333
333
 
334
- **Deploy via Cloudflare** (free, requires a Cloudflare account):
334
+ | Platform | Difficulty | Setup time | Why pick this |
335
+ |---|---|---|---|
336
+ | **Deno Deploy** | Easiest | ~2 min | Most reliable as of 2026; playground = no GitHub repo needed |
337
+ | **Vercel Edge Functions** | Easy | ~3 min | Good if you already use Vercel |
338
+ | **Cloudflare Workers** | Hard right now | ~5 min | Known dashboard deploy bugs; use only if others fail |
335
339
 
336
- 1. Go to https://dash.cloudflare.com Workers & Pages Create
337
- 2. Paste the contents of [`cf-worker/worker.js`](https://github.com/smithmx20/XAN/blob/main/cf-worker/worker.js) from the XAN repo
338
- 3. Deploy, copy the worker URL (e.g. `https://xan-proxy.you.workers.dev`)
339
- 4. Save it to SNI:
340
+ **Full step-by-step instructions for all three platforms are in [`worker/README.md`](worker/README.md).**
341
+
342
+ Quick Deno Deploy setup (recommended):
343
+
344
+ 1. Go to https://dash.deno.com → sign in with GitHub → "New Project" → "Playground"
345
+ 2. Paste the contents of [`worker/proxy.deno.js`](worker/proxy.deno.js) → click "Save & Deploy"
346
+ 3. Copy the URL (e.g. `https://your-project.deno.dev`)
347
+ 4. Save to SNI:
340
348
 
341
349
  ```bash
342
- sni config --update allanime_cf_worker_url='https://xan-proxy.you.workers.dev'
350
+ sni config --update allanime_cf_worker_url='https://your-project.deno.dev'
343
351
  ```
344
352
 
345
- **Can't create a Cloudflare account?** Deploy the same `worker.js` code to any of these alternative platforms (all have free tiers, none require a credit card):
346
-
347
- - **Deno Deploy** (https://dash.deno.com) — free, no card required, fastest setup. Wrap the worker's `fetch` handler in a `Deno.serve()` call.
348
- - **Vercel Edge Functions** (https://vercel.com) — free tier. Adapt the handler to Vercel's `export default function handler(req: Request)` signature.
349
- - **Netlify Functions** (https://netlify.com) — free tier. Convert to Netlify's `exports.handler` format.
353
+ 5. Try: `sni play "one piece"`
350
354
 
351
355
  The worker code is platform-agnostic — it's just a `fetch` handler that proxies a request. The only thing that changes between platforms is the entry-point wrapper.
352
356
 
@@ -9,7 +9,7 @@ build-backend = "hatchling.build"
9
9
  # just `sni` (defined below in [project.scripts]), so users run `sni play`,
10
10
  # `sni tui`, etc. — only `pip install sni-cli` differs from the bare name.
11
11
  name = "sni-cli"
12
- version = "1.2.2"
12
+ version = "1.2.4"
13
13
  description = "Stream Ninja Interface — terminal-based anime streaming CLI + TUI"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.10"
@@ -0,0 +1 @@
1
+ __version__ = "1.2.4"
@@ -529,17 +529,16 @@ def config(
529
529
  " sni config --update allanime_cookies='cf_clearance=...;'\n"
530
530
  " Or write to file (easier to refresh):\n"
531
531
  f" echo 'cf_clearance=...;' > {DEFAULT_COOKIES_PATH}\n\n"
532
- "[bold yellow]Option 2 - Cloudflare Worker[/bold yellow]\n"
532
+ "[bold yellow]Option 2 - Self-hosted proxy worker[/bold yellow]\n"
533
533
  "[bold yellow](last resort for VPN/shared IPs):[/bold yellow]\n"
534
- " Deploy the XAN CF Worker (free, requires Cloudflare account):\n"
535
- " 1. https://dash.cloudflare.com -> Workers & Pages -> Create\n"
536
- " 2. Paste XAN/cf-worker/worker.js from the XAN repo\n"
537
- " 3. Deploy, copy the worker URL\n"
538
- " 4. sni config --update allanime_cf_worker_url='https://your-worker.workers.dev'\n"
539
- " Can't create a Cloudflare account? Deploy the same worker.js to:\n"
540
- " - Deno Deploy (https://dash.deno.com) - free, no card required\n"
541
- " - Vercel Edge Functions (https://vercel.com) - free tier\n"
542
- " - Netlify Functions (https://netlify.com) - free tier\n",
534
+ " SNI ships worker code in the worker/ directory. Deploy to ANY of:\n"
535
+ " - Deno Deploy (recommended): https://dash.deno.com -> Playground\n"
536
+ " Paste worker/proxy.deno.js -> Save & Deploy. ~2 min, no card.\n"
537
+ " - Vercel Edge Functions: https://vercel.com (3 min)\n"
538
+ " - Cloudflare Workers: https://dash.cloudflare.com (5 min, flaky)\n"
539
+ " See worker/README.md in the repo for full step-by-step.\n"
540
+ " Then save the URL:\n"
541
+ " sni config --update allanime_cf_worker_url='https://your-deployment'\n",
543
542
  title="AllAnime captcha bypass",
544
543
  border_style="cyan",
545
544
  ))
@@ -242,8 +242,8 @@ class AllAnimeProvider(Provider):
242
242
  Fallback order:
243
243
  1. Direct request to api.allanime.day (fastest when not captcha-walled)
244
244
  2. Each public CORS proxy in PUBLIC_PROXIES (no user config needed)
245
- 3. CF Worker (only if user configured allanime_cf_worker_url — but
246
- CF Workers are GET-only, so this raises a clear error instead)
245
+ 3. CF Worker (if user configured allanime_cf_worker_url — the v3
246
+ worker in worker/proxy.js supports POST)
247
247
 
248
248
  CaptchaRequiredError is raised only when ALL fallbacks fail.
249
249
  """
@@ -255,6 +255,12 @@ class AllAnimeProvider(Provider):
255
255
  fallbacks: List[tuple] = [("direct", self.GRAPHQL_URL)]
256
256
  for i in range(len(self.PUBLIC_PROXIES)):
257
257
  fallbacks.append(("proxy", self._proxy_url(i, self.GRAPHQL_URL)))
258
+ if self.cf_worker_url:
259
+ # CF Worker v3 supports POST — body is forwarded as-is
260
+ fallbacks.append(("worker", _build_cf_worker_url(
261
+ self.cf_worker_url, self.GRAPHQL_URL,
262
+ extra_headers={"Referer": self.REFERER, "Origin": self.ORIGIN},
263
+ )))
258
264
 
259
265
  # If a proxy previously worked, try it first (skip the dead direct)
260
266
  if self._working_proxy_idx is not None:
@@ -0,0 +1,133 @@
1
+ # SNI Stream Proxy — Self-Hostable Captcha Bypass
2
+
3
+ This directory contains the proxy worker code that SNI uses as a fallback when your IP is captcha-walled on `api.allanime.day`. The worker is a simple JavaScript `fetch` handler that proxies requests through a clean IP (the platform's IP, not yours), which AllAnime's Cloudflare edge doesn't flag.
4
+
5
+ ## When you need this
6
+
7
+ You need this **only** if ALL of these are true:
8
+
9
+ 1. `sni play "one piece"` fails with `NEED_CAPTCHA` or `ConnectTimeout`
10
+ 2. `curl -I https://api.allanime.day` times out or returns 403 from your machine
11
+ 3. `curl -I https://proxy.cors.sh` also times out (SNI's built-in public proxy fallback doesn't work for you)
12
+
13
+ If any of those work, you don't need this — SNI's built-in fallbacks already cover you.
14
+
15
+ ## Three deployment options (all free, no credit card required)
16
+
17
+ Pick **one**. All three run the same JavaScript code (slightly different entry-point wrappers).
18
+
19
+ | Platform | Free tier | Signup difficulty | Setup time |
20
+ |---|---|---|---|
21
+ | **Deno Deploy** | 1M req/month | Easy (GitHub login) | ~2 min |
22
+ | **Vercel Edge Functions** | 1M req/month | Easy (GitHub login) | ~3 min |
23
+ | **Cloudflare Workers** | 100K req/day | Hard right now (deploy bugs) | ~5 min |
24
+
25
+ **If you can't create a Cloudflare Worker (the Hello World project won't deploy), use Deno Deploy instead — it's the most reliable as of 2026.**
26
+
27
+ ---
28
+
29
+ ## Option 1: Deno Deploy (recommended — most reliable)
30
+
31
+ 1. Go to https://dash.deno.com → Sign in with GitHub
32
+ 2. Click **"New Project"**
33
+ 3. Click **"Playground"** (top-right, lets you paste code directly — no GitHub repo needed)
34
+ 4. Delete the default code, paste the entire contents of [`proxy.deno.js`](./proxy.deno.js) from this directory
35
+ 5. Click **"Save & Deploy"**
36
+ 6. You'll get a URL like `https://your-project.deno.dev` — copy it
37
+ 7. Test it in your browser: visit `https://your-project.deno.dev/` — you should see `{"ok":true,"service":"sni-stream-proxy",...}`
38
+ 8. Save it to SNI:
39
+
40
+ ```bash
41
+ sni config --update allanime_cf_worker_url='https://your-project.deno.dev'
42
+ ```
43
+
44
+ 9. Try SNI: `sni play "one piece"`
45
+
46
+ ---
47
+
48
+ ## Option 2: Vercel Edge Functions
49
+
50
+ 1. Go to https://vercel.com → Sign in with GitHub
51
+ 2. Click **"Add New"** → **"Project"**
52
+ 3. Click **"Create New Project"** → under "No Framework", click **"Browse all templates"** → pick **"Blank"**
53
+ 4. Name your project, click **"Deploy"** (this creates an empty project)
54
+ 5. Once deployed, click **"Continue to Dashboard"** → **"Code"** tab → **"Files"** tab
55
+ 6. Create a new folder called `api` and a file inside it called `proxy.js`
56
+ 7. Paste the entire contents of [`api/proxy.js`](./api/proxy.js) into that file
57
+ 8. Click **"Commit"** → **"Commit & Deploy"**
58
+ 9. Once redeployed, your URL will be `https://your-project.vercel.app/api/proxy` — copy it
59
+ 10. Test it in your browser: visit `https://your-project.vercel.app/api/proxy` — you should see `{"ok":true,...}`
60
+ 11. Save it to SNI:
61
+
62
+ ```bash
63
+ sni config --update allanime_cf_worker_url='https://your-project.vercel.app/api/proxy'
64
+ ```
65
+
66
+ 12. Try SNI: `sni play "one piece"`
67
+
68
+ ---
69
+
70
+ ## Option 3: Cloudflare Workers
71
+
72
+ Use this only if Deno Deploy and Vercel both fail for you.
73
+
74
+ 1. Go to https://dash.cloudflare.com → sign up / sign in
75
+ 2. Left sidebar → **"Workers & Pages"** → **"Create"** → **"Create Worker"**
76
+ 3. Give it a name (e.g. `sni-proxy`) → click **"Deploy"**
77
+ 4. Click **"Edit code"** (top-right)
78
+ 5. Delete the default code, paste the entire contents of [`proxy.js`](./proxy.js) from this directory
79
+ 6. Click **"Deploy"** (top-right)
80
+ 7. Your URL will be `https://sni-proxy.<your-subdomain>.workers.dev` — copy it
81
+ 8. Test it in your browser: visit the URL — you should see `{"ok":true,...}`
82
+ 9. Save it to SNI:
83
+
84
+ ```bash
85
+ sni config --update allanime_cf_worker_url='https://sni-proxy.your-subdomain.workers.dev'
86
+ ```
87
+
88
+ 10. Try SNI: `sni play "one piece"`
89
+
90
+ **If the "Hello World" project won't deploy:** This is a known Cloudflare dashboard bug. Try:
91
+ - Use a different browser (Chrome instead of Firefox, or vice versa)
92
+ - Disable ad-blockers / privacy extensions
93
+ - Try incognito mode
94
+ - Wait 30 minutes and retry (sometimes it's a transient outage)
95
+ - **Or just use Deno Deploy instead** (Option 1) — it's more reliable right now
96
+
97
+ ---
98
+
99
+ ## How it works
100
+
101
+ SNI's `AllAnimeProvider` tries these in order when fetching anime data:
102
+
103
+ 1. **Direct request** to `api.allanime.day` — fastest, works for most users
104
+ 2. **proxy.cors.sh** (built-in public proxy) — automatic fallback, no setup needed
105
+ 3. **Your self-hosted worker** (this directory) — last resort, only used if you configured `allanime_cf_worker_url`
106
+ 4. **CF Worker** (Cloudflare's own IPs) — same as #3, just deployed on Cloudflare specifically
107
+
108
+ The worker:
109
+ - Accepts GET and POST requests
110
+ - Proxies them to the target URL with proper headers (Referer, Origin, User-Agent)
111
+ - Only allows requests to a hardcoded list of AllAnime-related hosts (security: prevents abuse)
112
+ - Streams the response body back (supports large video files)
113
+
114
+ ## Security
115
+
116
+ The worker has a hardcoded allowlist of hosts it will proxy (`ALLOWED_HOSTS` in the code). It will refuse to proxy requests to any other host. This prevents someone from using your worker as an open proxy for arbitrary traffic.
117
+
118
+ ## Verification
119
+
120
+ After configuring your worker URL, verify SNI can use it:
121
+
122
+ ```bash
123
+ # Should print the version
124
+ sni --version
125
+
126
+ # Should search successfully (using your worker if direct fails)
127
+ sni search "one piece"
128
+
129
+ # Should play successfully
130
+ sni play "one piece"
131
+ ```
132
+
133
+ If you still get `NEED_CAPTCHA` or `ConnectTimeout`, run `sni config --cookie-info` for more options or open an issue at https://github.com/sundeepyt2/SNI/issues
@@ -1 +0,0 @@
1
- __version__ = "1.2.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes