Metadata-Version: 2.4
Name: insta2table
Version: 0.1.0
Summary: Fetch Instagram captions (with optional OCR) and convert them to a normalized table via Gemini.
Author: S. Kashyap
License: MIT License
Project-URL: Homepage, https://github.com/Sk1499/insta2table
Project-URL: Issues, https://github.com/Sk1499/insta2table/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.0
Requires-Dist: tqdm>=4.66
Requires-Dist: tenacity>=8.2
Requires-Dist: python-dotenv>=1.0
Requires-Dist: instaloader>=4.12
Requires-Dist: requests>=2.31
Provides-Extra: ocr
Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
Requires-Dist: Pillow>=10.0; extra == "ocr"
Provides-Extra: genai
Requires-Dist: langchain>=0.2.0; extra == "genai"
Requires-Dist: langchain-google-genai>=2.0.0; extra == "genai"
Dynamic: license-file

# 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).
