semvec/pypi-packages huggingface dataset:
insta2table 0.1.0
Fetch Instagram captions (with optional OCR) and convert them to a normalized table via Gemini.
License: MIT License
Requires Python: >=3.9

# insta2table

[![CI](https://github.com/Sk1499/insta2table/actions/workflows/ci.yml/badge.svg)](https://github.com/Sk1499/insta2table/actions)
[![PyPI version](https://img.shields.io/pypi/v/insta2table.svg)](https://pypi.org/project/insta2table/)


A tiny toolkit to:
1. **Crawl Instagram links** from a text file, extract captions and (optionally) **OCR** text from images → `output.csv`
2. **Convert** those rows into a clean **single-row table** per link using **Gemini** → `result.csv`

> Credentials & keys via env:
> - `IG_USER`, `IG_PASS` (optional): for Instaloader login (reduces 403s)
> - `GOOGLE_API_KEY`: required for Gemini

## Quickstart

```bash
# 1) (Recommended) Create and activate a virtualenv
python -m venv .venv
# Linux/macOS
source .venv/bin/activate
# Windows (PowerShell)
# .venv\Scripts\Activate.ps1

# 2) Install (with OCR & Gemini extras if you need them)
pip install -e .[ocr,genai]

# 3) Prepare links
cp examples/links.txt .

# 4) Crawl -> output.csv
export IG_USER="your_user"
export IG_PASS="your_pass"
insta2csv --links links.txt --out output.csv

# 5) Process with Gemini -> result.csv
export GOOGLE_API_KEY="your_key"
insta2table --in output.csv --out result.csv
```

## CLI

```bash
insta2csv --links links.txt --out output.csv [--no-ocr]
insta2table --in output.csv --out result.csv
```

## Notes
- OCR requires Tesseract installed on your system if you opt in.
- Instagram scraping without login can trigger 403s. Supplying IG credentials helps.
- Gemini formatting expects a single-row Markdown table per input.


## Publishing

We use **trusted publishing** from GitHub to PyPI (no API token needed).

1. Create the project on PyPI (only first time) and enable **'Manage publishing'** with GitHub OIDC for your repo.
2. In GitHub: create a new Release with a tag like `v0.1.0`.
3. The **Publish to PyPI** workflow will build and upload the release automatically.
4. Alternatively (manual): `make build` then `twine upload dist/*` (requires a PyPI token).