Metadata-Version: 2.4
Name: pkg-anime-wave-1
Version: 1.0.0
Summary: Anime downloader for aniwaves.ru — search, browse, HLS download with resume. Works on ARM7 Termux.
License: MIT
Project-URL: Homepage, https://pypi.org/project/pkg-anime-wave-1/
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28
Requires-Dist: rich>=13.0
Requires-Dist: InquirerPy>=0.3.4
Requires-Dist: tqdm>=4.64

# pkg-anime-wave-1

Anime downloader for **aniwaves.ru** (the engine behind wcostream.one).  
Works on **ARM7 Termux** (2 GB phones), pure Python — zero Rust, zero native extensions required.

## Install

```bash
pip install -U pkg-anime-wave-1
pkg install ffmpeg        # required for muxing segments
```

## Usage

```bash
wave                          # fully interactive
wave "naruto"                 # search then pick episodes interactively
wave "naruto" -e 1-26         # episodes 1–26
wave "naruto" --all           # every episode
wave "naruto" -e 1,3,7        # specific episodes
wave "naruto" -r 720 -l dub   # 720p dub
wave "one piece" -e 1-100 -r 1080 -d /sdcard/Anime

wave --set-dir /sdcard/Anime  # save default download folder
wave --refresh-index          # force-rebuild the local title index
```

## Options

| Flag | Default | Description |
|---|---|---|
| `-e`, `--episodes` | interactive | Episode spec: `1-12`, `all`, `1,3,7`, combinations |
| `--all` | — | Download every episode |
| `-r`, `--resolution` | `1080` | Preferred quality: `1080`, `720`, `480`, `best` |
| `-l`, `--lang` | `sub` | `sub` \| `dub` \| `all` |
| `-d`, `--dir` | `~/Downloads/aniwaves` | Download directory |
| `-t`, `--threads` | `4` | Parallel segment threads |
| `--set-dir DIR` | — | Persist download directory to config |
| `--refresh-index` | — | Rebuild local title cache from sitemaps |

## Resume

If a download is interrupted, re-run the **exact same command**.  
Completed segments are cached in `/tmp/aniwave_segs/` and skipped.  
A `.done` marker file is written only when an episode finishes completely.

## How it works

1. **Search** — Downloads the site's sitemaps (9,600+ titles) on first run and caches them in `~/.aniwave_index.json`. Subsequent searches are instant fuzzy-matches against the local index.  
2. **Episodes** — Fetches the episode list from `aniwaves.ru/ajax/episode/list/{id}`.  
3. **Servers** — Fetches available stream servers (Vidplay, BYFMS, DGHG) for each episode.  
4. **Stream** — Resolves the HLS `.m3u8` URL from the embed player and downloads segments in parallel.  

No Cloudflare challenge needed for any of these steps.

## ARM7 Termux notes

All dependencies are pure Python — no Rust toolchain needed.  
Optional: install `yt-dlp` for better embed extraction fallback.

```bash
pip install yt-dlp   # optional but recommended
```

## License

MIT
