Skip to content

v1.3.0 — Route stream URLs through CF Worker (fixes 403 from all video CDNs)

Choose a tag to compare

@sundeepyt2 sundeepyt2 released this 03 Jul 08:21

Root cause

Even with the correct Referer (v1.2.9 fix), mp4upload returned 403 because the user's IP is blocked by the CDN — the same IP blocking that affects api.allanime.day. The Referer fix was necessary but not sufficient.

The user falls through to mp4upload because ALL higher-priority sources also fail:

  1. Yt-mp4 (tools.fast4speed.rsvp) → 403 (IP blocked by Cloudflare)
  2. S-mp4 (allanime.day clock.json) → blocked (redirect loop / IP)
  3. Mp4 (a4.mp4upload.com:183) → 403 (IP blocked by mp4upload CDN)

ALL direct stream URLs fail for the user's IP.

The fix

When a CF Worker is configured (allanime_cf_worker_url), SNI now wraps the stream URL through the worker too — not just the API calls. The worker has a clean IP that video CDNs don't block.

Applied to all three extraction paths:

  1. _extract_source (Yt-mp4): wraps the fast4speed URL through the worker
  2. _fetch_clock_json (S-mp4): wraps the clock.json stream URL
  3. _scrape_embed (mp4upload/filemoon/etc): wraps the scraped video URL

The worker URL format:

https://your-worker.deno.dev/?url=<encoded_stream_url>&h_Referer=...&h_Origin=...

mpv plays the worker URL → worker proxies the request to the real CDN with correct headers + its own clean IP → streams the video back to mpv.

What you need to do

1. Deploy a CF Worker (if you haven't already)

Follow the instructions at https://github.com/sundeepyt2/SNI/blob/main/worker/README.md — use Deno Deploy Playground (easiest, ~2 min).

2. Save the worker URL

sni config --update allanime_cf_worker_url='https://your-project.deno.dev'

3. Upgrade + play

pip install --upgrade sni-cli
sni play "Tsue to Tsurugi no Wistoria"

SNI will now route BOTH the API calls AND the stream URLs through your worker, bypassing all IP blocking.

Verified

  • ruff check sni/ → All checks passed
  • pytest -q → 44 passed (3.75s)
  • python -m build → sdist + wheel both pass twine check
  • Stream URL wrapping logic verified for Yt-mp4, S-mp4, and mp4upload sources

Full changelog: v1.2.9...v1.3.0