Metadata-Version: 2.4
Name: content-foundry
Version: 1.0.0
Summary: A resumable multi-agent pipeline that researches, writes, judges, narrates, and renders short-form YouTube videos for any niche.
Author-email: Pranshu Mishra <pranshumshr.04@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/pranshu97/content-foundry
Project-URL: Repository, https://github.com/pranshu97/content-foundry
Project-URL: Issues, https://github.com/pranshu97/content-foundry/issues
Keywords: youtube,video-generation,ai-agents,llm,gemini,content-automation,text-to-speech,ffmpeg,pipeline
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.7
Requires-Dist: pydantic-settings>=2.3
Requires-Dist: httpx>=0.27
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: lxml>=5.2
Requires-Dist: ddgs>=6.0
Requires-Dist: SQLAlchemy>=2.0
Requires-Dist: typer>=0.12
Requires-Dist: APScheduler>=3.10
Requires-Dist: tenacity>=8.5
Requires-Dist: structlog>=24.1
Requires-Dist: rich>=13.7
Requires-Dist: python-dateutil>=2.9
Requires-Dist: python-ulid>=2.7
Requires-Dist: Pillow>=10.4
Requires-Dist: ffmpeg-python>=0.2
Requires-Dist: pydub>=0.25
Requires-Dist: edge-tts>=6.1
Requires-Dist: anthropic>=0.39
Requires-Dist: openai>=1.50
Provides-Extra: youtube
Requires-Dist: google-api-python-client>=2.140; extra == "youtube"
Requires-Dist: google-auth-oauthlib>=1.2; extra == "youtube"
Requires-Dist: google-auth-httplib2>=0.2; extra == "youtube"
Provides-Extra: tts
Requires-Dist: elevenlabs>=1.5; extra == "tts"
Requires-Dist: piper-tts>=1.2; extra == "tts"
Provides-Extra: image
Requires-Dist: stability-sdk>=0.8; extra == "image"
Provides-Extra: video
Requires-Dist: moviepy>=1.0.3; extra == "video"
Provides-Extra: whisper
Requires-Dist: faster-whisper>=1.0; extra == "whisper"
Provides-Extra: dashboard
Requires-Dist: streamlit>=1.37; extra == "dashboard"
Provides-Extra: avatar
Requires-Dist: rembg>=2.0; extra == "avatar"
Provides-Extra: clone
Requires-Dist: chatterbox-tts>=0.1; extra == "clone"
Provides-Extra: faceid
Requires-Dist: diffusers==0.29.0; extra == "faceid"
Requires-Dist: transformers==4.44.2; extra == "faceid"
Requires-Dist: numpy<2.0.0; extra == "faceid"
Requires-Dist: safetensors==0.5.3; extra == "faceid"
Requires-Dist: accelerate>=0.28; extra == "faceid"
Requires-Dist: insightface>=0.7; extra == "faceid"
Requires-Dist: onnxruntime-gpu<1.23,>=1.19; extra == "faceid"
Requires-Dist: opencv-python-headless>=4.9; extra == "faceid"
Provides-Extra: all
Requires-Dist: elevenlabs>=1.5; extra == "all"
Requires-Dist: piper-tts>=1.2; extra == "all"
Requires-Dist: stability-sdk>=0.8; extra == "all"
Requires-Dist: moviepy>=1.0.3; extra == "all"
Requires-Dist: faster-whisper>=1.0; extra == "all"
Requires-Dist: streamlit>=1.37; extra == "all"
Requires-Dist: rembg>=2.0; extra == "all"
Requires-Dist: google-api-python-client>=2.140; extra == "all"
Requires-Dist: google-auth-oauthlib>=1.2; extra == "all"
Requires-Dist: google-auth-httplib2>=0.2; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=8.3; extra == "dev"
Requires-Dist: pytest-mock>=3.14; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: respx>=0.21; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: mypy>=1.11; extra == "dev"
Requires-Dist: pre-commit>=3.8; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5.1; extra == "dev"
Dynamic: license-file

# Content Foundry

An autonomous, fully-resumable multi-agent pipeline that turns real labor-market data into a
published (Private/Unlisted draft) YouTube video — grounded in data, gated by a
strict quality rubric, and compliant with synthetic-content disclosure by default.

**Pipeline:** Data Fetcher → Script Generator → Judge → Voiceover → Visuals → Render → Publish

> The complete engineering specification (single source of truth) lives in [`spec/`](spec/README.md).
> A high-level architecture summary is in [`TECH_REPORT.md`](TECH_REPORT.md), and the operator guide
> in [`Tutorial.md`](Tutorial.md).

## Live channel

Watch the output live: **[youtube.com/@TheCrackedEng](https://www.youtube.com/@TheCrackedEng)**

> **Disclaimer:** This channel is 100% generated, voiced, and published autonomously by this repository.

## Quickstart

```bash
# 1. Create & activate a Python 3.11+ environment, then install
pip install -r requirements.txt
pip install -e .            # exposes the `content-foundry` CLI

# 2. Configure
cp .env.example .env        # fill in your keys (see Human_Tasks.md)

# 3. Initialise the database
python scripts/init_db.py

# 4. Smoke test (no upload, stops at the Judge)
content-foundry run --niche "tech careers" --to-stage judge

# Or produce a vertical YouTube Short instead of a long video (one switch):
content-foundry run --niche "tech careers" --idea "your topic" --format short
```

See [`spec/23-deployment-instructions.md`](spec/23-deployment-instructions.md) for full deployment,
[`spec/17-cli-interface.md`](spec/17-cli-interface.md) for every command, and
[`Human_Tasks.md`](Human_Tasks.md) for the manual setup checklist (API keys, OAuth, Telegram bot).

## Project layout

```
src/content_foundry/    # the engine (models, agents, providers, pipeline, ...)
dashboard/            # Streamlit review dashboard
scripts/              # init_db, seed_demo
tests/                # unit / agent / integration / e2e (dry-run)
spec/                 # the authoritative specification (25 chapters)
output/runs/<run_id>/ # per-run artifacts + media + package.md
```

## Cost discipline

Only **Agent 2 (Script Generator)** always calls an LLM. The Data Fetcher, most of the Judge, and
the Visuals prompt-builder are deterministic Python — free, fast, and hallucination-proof.

Cost levers (cheapest first):
- **Run the LLM locally** — `PRIMARY_PROVIDER=local` (Ollama / LM Studio / vLLM) makes generation free.
- **Free voice** — `TTS_PROVIDER=edge` (Microsoft neural, free, no key) or `piper` (fully offline), or `chatterbox` to **clone your own voice** free & locally (MIT-licensed, safe to monetize; GPU recommended). Paid: elevenlabs / openai. Voices auto-alternate male/female by run number.
- **Free visuals** — `IMAGE_PROVIDER=none` renders polished title cards; add free Pexels + Pixabay keys for real, moment-matched B-roll (a clip per narration beat), now held to a STRICT on-topic bar — a beat with no confidently-relevant clip falls back to a bespoke generated image (or a clean card when no image provider is set), never an off-topic clip.
- **Free research (default)** — `ENABLED_SOURCES=search` runs free DuckDuckGo web research on your run's topic (no key), so it works on **any** niche out of the box; the labor-market feeds (adzuna/layoffs/bls) are opt-in add-ons.
- **Free idea discovery** — `IDEA_MINING_ENABLED=true` + a free `YOUTUBE_API_KEY` mines *proven* outlier videos in your niche (views far above the channel's median) so each run builds a topic with demonstrated demand instead of a guess; best-effort, so it never blocks a run.
- **Free polish** — bundled sound effects (`SFX_ENABLED`), scene crossfades, a warm grade, and a Subscribe nudge are all local/ffmpeg (no paid services).
- **`--profile cheap`** — deterministic judge + Pillow cards (no image API) + a single revision.
- **Hard budget cap** — `ENFORCE_BUDGET_CAP=true` aborts a run once estimated month-to-date spend
  reaches `MONTHLY_BUDGET_USD` (on by default; cost safety, not just an alert).
- **Resume reuses paid artifacts** — re-running a stage reuses existing voiceover/visuals instead of
  paying again (use `--force` to regenerate).
- **`FAIL_FAST_SCORE`** (opt-in) — stop paying for revisions a hopeless script can't recover from.

Use `--profile quality` for publishing.

## Testing

```bash
pytest                # unit + agent + integration + e2e dry-run, ≥85% coverage gate
```

All tests run offline — vendors are mocked behind their protocols; no real network or API calls.
