Metadata-Version: 2.4
Name: cine-tmux
Version: 1.0.4
Summary: 123Cine.to movie & TV downloader for Termux — fast CLI with fzf picker
Author: cine-tmux contributors
License: MIT
Project-URL: Homepage, https://github.com/cine-tmux/cine-tmux
Project-URL: Bug Tracker, https://github.com/cine-tmux/cine-tmux/issues
Keywords: movies,tv,downloader,termux,hls,m3u8,123cine,cloudscraper,streaming
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Video
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: cloudscraper>=1.2.60
Requires-Dist: requests>=2.28
Requires-Dist: loguru>=0.6
Requires-Dist: rich>=13.0
Requires-Dist: beautifulsoup4>=4.11
Requires-Dist: questionary>=2.0
Requires-Dist: pyfzf>=0.3
Requires-Dist: tqdm>=4.64
Requires-Dist: pycryptodome>=3.15
Provides-Extra: browser
Requires-Dist: playwright>=1.40; extra == "browser"
Dynamic: requires-python

# cine-tmux

Download movies and TV shows from **123cine.to** directly in your Termux terminal.

```
cine "avengers endgame"
cine --browse movie
cine --browse tv --genre action
cine "breaking bad" --type tv -e 1-10
cine "inception" --quality 720p --play
```

---

## Features

- **Fast search** — no browser, uses cloudscraper to bypass Cloudflare
- **Browse** latest movies/TV from the home page or by genre (action, drama, thriller, …)
- **fzf picker** — fuzzy-find titles, seasons, and episodes interactively
- **Batch download** TV episodes with `--episodes 1-10` or `1,3,5`
- **Quality selection** — 1080p / 720p / 480p / best
- **Stream** directly in mpv with `--play`
- **HLS downloader** — pure Python, concurrent segments, tqdm progress bar
- **Token caching** — browser only opens once per title, token reused for days
- Playwright only for auth-gated calls (episode link IDs, embed URL); everything else is pure Python

---

## Install

```bash
pip install cine-tmux
cine --install-browser          # downloads Chromium for Playwright (~300 MB, one-time)
```

> **Important:** `playwright` is an **optional** dependency — `pip install cine-tmux` works on
> all platforms including Termux ARM64. The browser is installed separately via
> `python3 -m playwright install chromium` (or the built-in `cine --install-browser`).

On **Termux** (Android):
```bash
# Step 1 — Termux packages (from F-Droid Termux, not Play Store)
pkg update && pkg upgrade
pkg install python fzf ffmpeg mpv

# Step 2 — Install cine-tmux (no playwright conflict!)
pip install cine-tmux

# Step 3 — Download Chromium (one-time, ~300 MB)
cine --install-browser
# or: python3 -m playwright install chromium

# Step 4 — Run
cine --help
```

> **Note:** Do NOT use `pkg install chromium` — it is not in Termux's ARM64 repo.
> Do NOT use `playwright install chromium` — the bare CLI may not be on PATH.
> Use `cine --install-browser` or `python3 -m playwright install chromium` instead.

---

## Setup (optional — for full access)

Some content requires a 123cine.to account. Run:

```bash
cine --setup
```

Then paste your session cookie from the browser DevTools (Application → Cookies → 123cine.to).

---

## Usage

```
cine "movie title"               search and download interactively
cine --browse movie              browse latest movies from home page
cine --browse tv                 browse latest TV shows
cine --browse movie --genre action  browse action movies
cine "inception" --quality 720p  download at 720p
cine "naruto" --type tv -e 1-10  batch download episodes 1-10
cine "interstellar" --play       stream in mpv
cine --setup                     save session cookie for auth
cine --config show               show current config
cine --help                      all options
```

### Options

| Flag | Description |
|---|---|
| `query` | Title to search for |
| `--browse movie\|tv` | Browse home page listings |
| `--genre NAME` | Filter browse by genre |
| `--type movie\|tv` | Filter search results |
| `--quality QUALITY` | `best`, `1080p`, `720p`, `480p` |
| `--episodes RANGE` | Episode range: `1`, `1-5`, `1,3,5` |
| `--output DIR` | Download directory |
| `--play` | Stream in mpv instead of downloading |
| `--player NAME` | Media player (default: mpv) |
| `--server N` | Which streaming server to use (0-based) |
| `--no-interactive` | Auto-select first result (batch mode) |
| `--setup` | Save session cookie |
| `--verbose` | Debug logging |

---

## How it works

1. **Search / Browse** — CloudScraper (no browser) hits the REST API or parses home page HTML
2. **Episodes list** — CloudScraper + cached signed token (extracted once via Playwright)
3. **Streaming links** — Playwright intercepts `/api/v1/episodes/{id}` (needs auth cookie)
4. **Embed URL** — Playwright intercepts `/api/v1/links/{id}`
5. **m3u8 capture** — Playwright opens embed page, captures HLS playlist URL
6. **Download** — pure Python HLS downloader, concurrent segment fetching

---

## Config

Config file: `~/.config/cine-tmux/config.ini`

```ini
[behavior]
download_dir = ~/Downloads/cine-tmux
quality = best
player = mpv
headless = true
workers = 8
verbose = false
```

---

## License

MIT
