# Instaloader Helper

A small wrapper around Instaloader to download a single Instagram post/reel.

Reference project: instaloader/instaloader (MIT) — https://github.com/instaloader/instaloader

## Setup

```bash
cd tools/instaloader
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

## Login options
- Env vars: `IG_USERNAME`, `IG_PASSWORD`
- Or a session file: `IG_SESSIONFILE` together with `--username`. Create it via:
  ```bash
  instaloader --login YOUR_USERNAME
  # After successful login, pass the created session file path via IG_SESSIONFILE or --sessionfile
  ```

## Usage
```bash
# In the virtualenv
python download_ig.py --url https://www.instagram.com/p/DPujDRJDNov/ --out ./downloads
# or provide username/password via env
IG_USERNAME=... IG_PASSWORD=... python download_ig.py --url https://www.instagram.com/p/.../ --out ./downloads
# or use a session file
IG_SESSIONFILE=/path/to/sessionfile python download_ig.py --url https://www.instagram.com/reel/.../ --username YOUR_USERNAME
```

- Prints the first downloaded `.mp4` path on success.
- Exits with non-zero code if the post is image-only or access is restricted.


