Skip to content

Morton26-ops/content-repurposer

Repository files navigation

Content Repurposer

Transform long-form content into platform-specific short-form posts using Claude API.

Paste a YouTube URL, blog article, or raw text — get content for 12 platforms streamed back in real time.

Python FastAPI Claude

Screenshot

Features

  • 3 input types — YouTube videos (transcript extraction), article URLs (web scraping), pasted text
  • 12 output formats — Twitter/X, LinkedIn, Instagram, TikTok, Newsletter, Facebook, Reddit, Threads, Pinterest, YouTube, Bluesky, Reels
  • Batch mode — Tick any subset of platforms, generate them all in parallel against a single extraction
  • Prompt caching — Source content cached on first call; subsequent platforms in the same batch hit cache (~5 min TTL)
  • Per-card streaming — Each selected platform gets its own card with live SSE output, copy button, and status badge
  • Copy-all — Concatenate every output into one clipboard payload, separated by platform headers — drop straight into a client deliverable
  • Selection memory — Your last platform picks persist in localStorage across sessions
  • Dark/light mode — Toggle with localStorage persistence

Quick Start

git clone https://github.com/Morton26-ops/content-repurposer.git
cd content-repurposer
pip install -r requirements.txt
cp .env.example .env
# Add your API key to .env
uvicorn main:app --reload

Open http://localhost:8000

API Key

Get one at console.anthropic.com. Add it to .env:

ANTHROPIC_API_KEY=sk-ant-...

Project Structure

content-repurposer/
├── main.py              # FastAPI app — GET /, POST /extract, POST /generate (SSE)
├── config.py            # Settings via pydantic-settings + .env
├── extractors.py        # YouTube transcript, URL scraping, text passthrough
├── prompts.py           # Platform rules + cached system-block builder
├── generator.py         # Claude async streaming + prompt caching
├── requirements.txt
├── .env.example
├── templates/
│   └── index.html       # Single-page UI
└── static/
    ├── style.css
    └── app.js           # Batch dispatch, SSE consumption, per-card rendering

How It Works

  1. User picks an input type, pastes content, and ticks one or more platforms
  2. Frontend POST /extract once → server fetches/scrapes/passes-through, returns the text
  3. Frontend POST /generate in parallel, once per selected platform, with the same extracted text
  4. Source content rides in the system= parameter with cache_control: ephemeral; the 2nd…Nth calls in the batch hit cache for the heavy prefix and only pay for the small per-platform rules block
  5. Each platform's response streams back via SSE into its own result card with a live cursor and per-card copy button

Output Format Rules

Platform Rules
Twitter/X 3-10 tweets, 280 chars each, numbered, hook first
LinkedIn 1000-1300 chars, hook line, short paragraphs, 3-5 hashtags
Instagram <300 char body, CTA, 15-25 hashtags
TikTok 150-300 word script, hook + [PAUSE] markers, 60-90 sec
Newsletter 400-600 words, subject line, bold section headers, key takeaway
Facebook 500-800 chars, storytelling hook, question CTA, 1-3 hashtags
Reddit Title + 300-600 word body, authentic tone, TL;DR, no emojis
Threads 3-7 posts, <500 chars each, casual tone, no hashtags
Pinterest 200-500 chars, SEO keywords, save/click CTA
YouTube Description + timestamps + key takeaways, 5-10 tags
Bluesky 3-8 posts, 300 chars each, witty/intellectual tone
Reels 100-200 word script, [CUT] + [TEXT ON SCREEN] markers, 30-60 sec

Tech Stack

  • Backend: FastAPI + Jinja2 + sse-starlette
  • AI: Claude API (claude-opus-4-7) with async streaming + prompt caching
  • Extraction: youtube-transcript-api, BeautifulSoup, requests
  • Config: pydantic-settings + python-dotenv

About

Transform long-form content into platform-specific short-form posts using Claude API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors