Skip to main content

AnimePahe downloader with automatic Cloudflare bypass via Playwright

Project description

AnimePahe Downloader

Downloads anime from animepahe.ru (also tries .com / .org).
Uses a real Chromium browser via Playwright to automatically solve Cloudflare's JS challenge — no manual cookie juggling needed.

Why Playwright?

AnimePahe uses Cloudflare's "Managed Challenge" (interactive JS mode) on every route including the JSON API.
Standard HTTP clients (requests, httpx, curl_cffi) cannot execute JavaScript and therefore always get a 403.
Playwright runs a real Chromium instance that solves the challenge exactly as a human browser would.

Quick Start

# 1. Install dependencies (once)
bash setup.sh

# 2. Run
python main.py

Usage

python main.py                          # interactive — prompts for everything
python main.py "Demon Slayer"           # search immediately, then pick episodes interactively
python main.py "Demon Slayer" --all     # download every episode
python main.py "Demon Slayer" -e 1-5   # episodes 1 through 5
python main.py "Demon Slayer" -e 1,3,7 # specific episodes
python main.py "Demon Slayer" --visible # show the browser window (useful for debugging)

How It Works

  1. Playwright launches a headless Chromium browser and visits animepahe.ru.
  2. Cloudflare's JS challenge runs inside the real browser — it solves automatically (~3–10 s).
  3. The solved session cookies (cf_clearance etc.) are extracted and reused in fast httpx API calls.
  4. For each episode, the script navigates to kwik.si in the browser to intercept the HLS .m3u8 URL.
  5. ffmpeg downloads and merges the HLS stream into a .mp4 file.

Output

Files are saved to downloads/<Anime Title>/Episode_NNNN.mp4.

Troubleshooting

Symptom Fix
CloudflareError: Timed out Run with --visible to watch the browser; the site may need a CAPTCHA click
ffmpeg: command not found Install ffmpeg: sudo apt install ffmpeg (or via your OS package manager)
No players found for an episode The episode may not be available yet; try again later
403 on API calls after warm-up Add --visible and watch — the browser may need user interaction

Requirements

  • Python 3.9+
  • ffmpeg (in PATH)
  • ~300 MB disk for Chromium (installed by playwright install chromium)

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

animepahe_dl_tmux-1.4.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

animepahe_dl_tmux-1.4.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file animepahe_dl_tmux-1.4.0.tar.gz.

File metadata

  • Download URL: animepahe_dl_tmux-1.4.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for animepahe_dl_tmux-1.4.0.tar.gz
Algorithm Hash digest
SHA256 5b965d0e1c20acd5808ce1b4b24fe3064573f65d999def3ea3ef13119cfdc674
MD5 dd08cc1f763694e69f0b9467db98a970
BLAKE2b-256 bd3068f865de417486686c700ab188d5df7366048b49eebb9f9839d38c60c757

See more details on using hashes here.

File details

Details for the file animepahe_dl_tmux-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for animepahe_dl_tmux-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c084e63f326cb08557b61c9010675d41e3ca701e549fc52dd61a069af90cd45
MD5 fee4bdf87bd4bbffd904f5b211a85046
BLAKE2b-256 aa64c2209592765b207388323320d52e8775090041959b0a7062a51710a72869

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