# Patreon Downloader Lightweight helpers for using `yt-dlp` to download media from Patreon posts you have access to. ## Contents - `with_ui.py` + `frontend.html` — browser-based UI for inspecting post metadata and streaming downloads. - `batch.py` — command-line batch downloader (supports `urls.json`). - `urls.sample.json` — example JSON input file. ## Features - Inspect available formats and metadata before downloading. - Stream `yt-dlp` output to the browser with live progress. - Batch-mode support for many posts via a JSON file or inline list. ## Requirements - Python 3.8+ and `pip`. - `yt-dlp` installed and available on PATH (or configure via environment variables). ## Installation 1. Clone the repository: ```bash git clone cd patreon-downloader ``` 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Export your Patreon cookies to `cookies.txt` (use a browser extension such as “Get cookies.txt”) and place it in the project root. ## Quick Start ### Web UI (recommended) 1. Start the UI server: ```bash python with_ui.py ``` 2. Open http://localhost:5000 in your browser. 3. Fill in the post URL and the path to `cookies.txt`. Inspect formats and click download. The terminal-like pane shows `yt-dlp` output live. ### Batch mode You can provide URLs in two ways: - Inline in `batch.py`: edit the `URLS` list. - JSON file: create `urls.json` (or set `URLS_JSON`) containing an array of URLs. Example `urls.json` format (see `urls.sample.json`): ```json ["https://www.patreon.com/posts/example-post-12345678", "https://www.patreon.com/posts/another-example-87654321"] ``` Run the batch script: ```bash python batch.py ``` ## Configuration - `YTDLP_PATH` (env): override `yt-dlp` executable for the UI server. - `DOWNLOAD_DIR` (env): override download directory used by the UI server. - `URLS_JSON` (env): path to a JSON file containing an array of URLs for `batch.py` (default: `./urls.json`). ## JSON input behavior (batch) - If `URLS_JSON` exists and contains a non-empty array of strings, `batch.py` will use those URLs. - If not present, `batch.py` falls back to the `URLS` list embedded in the script. ## Examples - Run single download quickly via UI. - Use `urls.sample.json` as a template for bulk downloads. ## Troubleshooting - `yt-dlp` extractor or permission errors: re-export `cookies.txt` and ensure they are up to date. - UI fetch timeout: the UI uses a 30s timeout for `--dump-json`; run the `yt-dlp --dump-json` command manually to debug. - If downloads fail on Windows, ensure `YTDLP` in `batch.py` points to `yt-dlp.exe`. ## Security & Ethics - Use this tool only for content you are authorized to access (e.g., from subscriptions you paid for). Respect creators' terms. ## Contributing - Bug reports and pull requests welcome. Keep changes minimal and focused. ## Files of interest - `with_ui.py` — Flask UI server and job manager. - `frontend.html` — browser interface. - `batch.py` — command-line batch downloader (now supports JSON input). - `requirements.txt` — Python dependencies. - `urls.sample.json` — example JSON file. ## Browser helper Use the included `get_urls.js` helper to extract post URLs from a Patreon page via the browser console. Paste and run the script in the console while viewing a page with posts; the script logs an array of URLs which you can right-click and "Copy Object" on. ## License - MIT No Attribution — see `MIT-0.txt`. ## Made with Claude Sonnet in about 15 Minutes.