Metadata-Version: 2.4
Name: thinkfic-downloader
Version: 0.1.1
Summary: Tools to download videos and slides from Thinkific
Author: Cervantes Hernandez
License-Expression: MIT
Project-URL: Homepage, https://github.com/crh2302/thinkfic-downloader
Project-URL: Repository, https://github.com/crh2302/thinkfic-downloader
Project-URL: Issues, https://github.com/crh2302/thinkfic-downloader/issues
Keywords: thinkific,downloader,videos,slides,yt-dlp
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml>=6.0
Requires-Dist: yt-dlp>=2025.1.15
Requires-Dist: requests>=2.32.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: colorama>=0.4.6
Requires-Dist: tqdm>=4.66.0
Provides-Extra: dev
Requires-Dist: black>=24.0.0; extra == "dev"
Requires-Dist: flake8>=7.0.0; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Dynamic: license-file

# Thinkific Downloader

Command-line tools to download **videos** and **slides** from Thinkific-based course platforms.

## Features

- Download videos with [`yt-dlp`](https://github.com/yt-dlp/yt-dlp).
- Download slides as images and convert them into PDFs.
- Configurable via `config.yaml` or environment variables (`.env`).
- Colored logging to console and file.
- Parallel downloads with `ThreadPoolExecutor` and progress bars with `tqdm`.
- Ready for reproducible installs with [`uv`](https://github.com/astral-sh/uv) and `pyproject.toml`.

## Requirements

- Python 3.9 or later.
- Dependencies listed in `pyproject.toml`.

## Installation

Clone the repository and set up a virtual environment:

```bash
git clone https://github.com/yourusername/thinkific-downloader.git
cd thinkific-downloader
python -m venv .venv
source .venv/bin/activate   # Linux/Mac
.venv\Scripts\activate      # Windows
```

### With uv (recommended)

```bash
uv pip install -e ".[dev]"
```

This reads directly from `pyproject.toml` and installs all dependencies (including dev tools if requested).

### With pip (fallback)

```bash
pip install -r requirements.txt
```

The `requirements.txt` file is auto-generated from `pyproject.toml` for compatibility.

## Usage

### Download videos

Define a `videos.yaml` file:

```yaml
- name: "Video_1"
  url: "https://example.com/video1.m3u8"
- name: "Video_2"
  url: "https://example.com/video2.m3u8"
```

Run:

```bash
thinkfic-video videos.yaml
```

Videos will be saved in a `videos_<timestamp>` folder.

### Download slides

Define a `slides.yaml` file:

```yaml
- name: "Module_I_II"
  last_url: "https://example.com/page_7.jpg"
```

Run:

```bash
thinkfic-slides slides.yaml
```

Slides will be combined into a PDF and stored in `slides_<timestamp>`.

## Configuration

Customizable via `.env` or `config.yaml`:

- `OUTPUT_DIR`, `VIDEOS_OUTPUT_DIR`, `SLIDES_OUTPUT_DIR`
- `MAX_WORKERS`, `MAX_RETRIES`, `RETRY_BACKOFF_SEC`
- `CONCURRENT_FRAGMENTS`, `RATE_LIMIT`
- `COOKIES_FILE`

Example `.env`:

```env
MAX_WORKERS=4
RATE_LIMIT=500K
COOKIES_FILE=cookies.txt
```

## Authentication / Cookies

At the moment, **cookies are not required**. Videos and slides can be downloaded directly if the URLs are public.

The `COOKIES_FILE` option is only provided for compatibility. If in the future Thinkific (or another platform) requires you to be logged in, you can export your browser session cookies (e.g. with a Chrome/Firefox extension like _Get cookies.txt_) and save them as `cookies.txt`.

- **Today** → You don’t need any cookies file.
- **Future** → If access becomes restricted, place `cookies.txt` in the project root and the tool will use it automatically.

## Development

Install development dependencies:

```bash
uv pip install -e ".[dev]"
```

Run lint and format:

```bash
just lint
just format
```

Run downloads:

```bash
just videos
just slides
```

## Contributing

1. Fork the repository.
2. Create a feature branch: `git checkout -b feature/new-feature`.
3. Open a pull request.

## License

MIT License. See the [LICENSE](LICENSE) file.

