Skip to main content
Glama
README.md
<p align="center">
  <img src="assets/logo/cinepull-logo-512.png" width="96" height="96" alt="Cinepull logo" />
</p>

<h1 align="center">Cinepull</h1>

<p align="center">
  <strong>Pull any video. Self-hostable &amp; public-capable web video downloader, 0-credit transcript extractor, and Streamable HTTP MCP service.</strong>
</p>

<p align="center">
  <a href="README.md">English</a> • <a href="README-CN.md">简体中文</a> • <a href="docs/README.md">Documentation</a>
</p>

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-3b52d9.svg" alt="License: MIT" /></a>
  <img src="https://img.shields.io/badge/Next.js-16-111114.svg" alt="Next.js 16" />
  <img src="https://img.shields.io/badge/MCP-Streamable%20HTTP-3b52d9.svg" alt="MCP Streamable HTTP" />
  <img src="https://img.shields.io/badge/Docker-Single%20Image-c26d48.svg" alt="Docker Single Image" />
  <a href="glama.json"><img src="https://img.shields.io/badge/Glama-MCP%20Ready-111114.svg" alt="Glama MCP" /></a>
</p>

---

## Screenshots

|               Desktop (Light — Porcelain)                |                Desktop (Dark — Velvet)                 |
| :------------------------------------------------------: | :----------------------------------------------------: |
| ![Cinepull Desktop Light](screenshots/desktop-light.png) | ![Cinepull Desktop Dark](screenshots/desktop-dark.png) |

|         Active Stage (Probe & Quality Drawer)          |          Mobile (`390×844` Single-Screen Fit)          |
| :----------------------------------------------------: | :----------------------------------------------------: |
| ![Cinepull Active Stage](screenshots/active-stage.png) | ![Cinepull Mobile Light](screenshots/mobile-light.png) |

---

## Key Capabilities

| Area                        | Details                                                                                                                                                                                                                                                                                      |
| :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **v3d Silk Editorial UI**   | 26-layer parametric silk-ribbon `<canvas>` (`prefers-reduced-motion` static fallback), FOUC-free `light-dark()` + `color-scheme`, full `en` / `zh-CN` i18n, global paste distillation, and `oklab` gradient progress CTA.                                                                    |
| **Share-Text Distillation** | Paste messy multi-line oral-copy from Douyin, Bilibili, Xiaohongshu, TikTok, YouTube, X, Instagram, or `.m3u8` anywhere on the page to distill the canonical URL locally.                                                                                                                    |
| **3-Path Media Engine**     | Server-side `execFile` (`shell: false`, `--`) orchestrating `yt-dlp` (+ Deno & optional `bgutil-ytdlp-pot-provider`), `ffmpeg` (HLS/M3U8 & DASH muxing), and `aria2c`/HTTP Range. Supports optional per-platform `EXTRACTOR_PROXY_URL`.                                                      |
| **0-Credit Transcripts**    | Extract WebVTT/SRT captions into clean Markdown or `.srt` in seconds via `/api/transcript` or `cinepull_transcript` at **0 credits**.                                                                                                                                                        |
| **Storage & Lifecycle**     | Per-job `/data/tmp/<job_id>/` isolation, `(url_hash, mode, quality)` dedup cache, HMAC-signed download links (max 3 downloads, HTTP Range), `active_streams > 0` delete lock, 5-min TTL sweeper (30m default), 5 GiB LRU eviction, and optional Cloudflare R2 delivery (`DELIVERY_MODE=r2`). |
| **Dual Mode & Auth**        | `PUBLIC_MODE=false` (zero-config self-host, unlimited) or `PUBLIC_MODE=true` (Better Auth GitHub/Google OAuth + Email/Resend, Turnstile, `credit_ledger` pre-charge/refund, GitHub Star + Follow X missions, `cp_live_...` API keys, 4D rate limits).                                        |
| **AI Agent & MCP**          | Built-in Streamable HTTP MCP server at `/api/mcp` (`cinepull_probe`, `cinepull_download`, `cinepull_transcript`, `cinepull_job_status`), `/llms.txt`, `/openapi.json`, `/.well-known/mcp.json`, `glama.json`, and `skills/cinepull/SKILL.md`.                                                |

---

## Quick Start

### 1. Docker Compose (Recommended Self-Host)

```bash
cp .env.example .env
# Edit .env and set strong values for BETTER_AUTH_SECRET and DOWNLOAD_HMAC_SECRET
docker compose up -d --build
```

Cinepull runs in `PUBLIC_MODE=false` by default (zero login required) and exposes `http://localhost:3000`. Verify health:

```bash
curl -sf http://localhost:3000/api/health
```

To enable the optional YouTube PO-token provider sidecar:

```bash
BGUTIL_POT_PROVIDER_URL=http://bgutil-pot:4416 docker compose --profile pot up -d
```

See [Local Deployment](docs/DEPLOY_LOCAL.md) and [VPS & R2 Deployment](docs/DEPLOY_VPS.md) for production setup (`PUBLIC_MODE=true`, `DELIVERY_MODE=r2`, `EXTRACTOR_PROXY_URL`).

### 2. Local Development

```bash
pnpm install
docker compose -f docker-compose.test.yml up -d --wait
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5433/cinepull_test pnpm db:migrate
pnpm dev
```

### Configuration

All configuration is via environment variables. [`.env.example`](.env.example) lists **every** variable the app, scripts, and Compose files read, with defaults and comments. The most important ones:

| Variable                                             | Required             | Purpose                                                                         |
| :--------------------------------------------------- | :------------------- | :------------------------------------------------------------------------------ |
| `DATABASE_URL`                                       | Yes                  | PostgreSQL 16 connection string (migrations run on container start).            |
| `BETTER_AUTH_SECRET`                                 | Yes                  | Session signing secret (`openssl rand -base64 32`).                             |
| `DOWNLOAD_HMAC_SECRET`                               | Recommended          | HMAC key for signed download links (falls back to `BETTER_AUTH_SECRET`).        |
| `BETTER_AUTH_URL`                                    | Yes (public)         | Public origin, e.g. `https://dl.example.com`.                                   |
| `PUBLIC_MODE`                                        | No (`false`)         | `true` enables login, credits, Turnstile, and rate limits.                      |
| `DELIVERY_MODE`                                      | No (`local`)         | `r2` uploads finished files to Cloudflare R2 (`R2_*` variables).                |
| `DATA_TMP_DIR`                                       | No (`/data/tmp`)     | Per-job scratch storage.                                                        |
| `GITHUB_CLIENT_ID/SECRET`, `GOOGLE_CLIENT_ID/SECRET` | No                   | OAuth sign-in providers (`PUBLIC_MODE=true`).                                   |
| `LOGTO_ENDPOINT`, `LOGTO_APP_ID`, `LOGTO_APP_SECRET` | No                   | Optional FireTable ID (Logto OIDC) sign-in, see [docs/LOGTO.md](docs/LOGTO.md). |
| `RESEND_API_KEY`, `RESEND_FROM_EMAIL`                | No                   | Email verification for email/password sign-up.                                  |
| `TURNSTILE_SITE_KEY`, `TURNSTILE_SECRET_KEY`         | No                   | Cloudflare Turnstile bot protection.                                            |
| `INITIAL_ADMIN_EMAIL`                                | No                   | Account created with this email becomes admin.                                  |
| `EXTRACTOR_PROXY_URL`, `EXTRACTOR_PROXY_<PLATFORM>`  | No                   | Outbound proxy for extractors.                                                  |
| `SSRF_BLOCKED_HOSTS`, `SSRF_BLOCKED_IPS`             | Recommended (public) | Extra SSRF blocklist for your own domains and server IPs.                       |

See [Auth, Credits & Quotas](docs/AUTH.md) for the full auth configuration.

---

## AI Agent & MCP Integration

Cinepull natively exposes a stateless Streamable HTTP MCP server at **`/api/mcp`** alongside machine-readable discovery manifests:

- **MCP Endpoint**: `POST` / `GET` / `DELETE /api/mcp` (`Accept: application/json, text/event-stream`)
- **Discovery**: [`/llms.txt`](app/llms.txt/route.ts), [`/openapi.json`](app/openapi.json/route.ts), [`/.well-known/mcp.json`](app/.well-known/mcp.json/route.ts), [`glama.json`](glama.json)
- **Bundled Agent Skill**: [`skills/cinepull/SKILL.md`](skills/cinepull/SKILL.md)

```json
{
  "mcpServers": {
    "cinepull": {
      "type": "http",
      "url": "http://localhost:3000/api/mcp",
      "headers": {
        "Authorization": "Bearer cp_live_your_key_here"
      }
    }
  }
}
```

In `PUBLIC_MODE=false`, `Authorization` is optional. In `PUBLIC_MODE=true`, generate a `cp_live_...` API key from the Studio account dialog (`Agent & API`) or `POST /api/keys`. See [MCP Integration Guide](docs/MCP.md).

---

## Documentation & Project Links

- **[Documentation Index](docs/README.md)** — Architecture, API reference, Auth & Credits, MCP, Security, Deployment, and CI/Testing
- **[Contributing Guide](CONTRIBUTING.md)** — Conventional Commits, zero-secrets policy, and verification commands
- **[Code of Conduct](CODE_OF_CONDUCT.md)** — Contributor Covenant 2.1
- **[Security Policy](SECURITY.md)** — report vulnerabilities privately, never in public issues
- **[License (MIT)](LICENSE)** — Copyright (c) 2026 FireTable
- **Hosted instance** — [dl.firetable.tech](https://dl.firetable.tech) ([Terms of Service](https://www.firetable.tech/terms) · [Privacy Policy](https://www.firetable.tech/privacy)). Self-hosted deployments are operated by their own administrators and are not covered by these policies.