FastAPI service that fetches and generates subtitles for YouTube videos — backend for SubtitleHub.
| Method | Path | Purpose |
|---|---|---|
POST |
/opensubtitles/login |
OpenSubtitles auth (returns token) |
GET |
/opensubtitles |
Search OpenSubtitles for movie/TV subs |
GET |
/download?url=<video> |
Fetch captions as SRT/VTT/TXT |
POST |
/download |
Same, POST variant |
GET |
/download/raw |
Raw transcript text |
GET |
/playlist |
Captions for a YouTube playlist |
GET |
/ |
Health check + endpoint list |
Fetch strategy (fallback chain):
youtube-transcript-api— fast, direct caption extractionyt-dlp— resilient pipeline for videos without auto-captions- YouTube timedtext proxy as last resort
Format conversion (format_output) → srt, vtt, txt, json.
- Rate limiting: 30 req / 60s per IP (
RATE_LIMIT_REQUESTS) - CORS enabled for web clients
- Optional OpenSubtitles integration for movie/TV subtitle search
pip install -r requirements.txt
uvicorn main:app --reloadOne-click on Render via render.yaml (uvicorn). If using OpenSubtitles, import OPENSUBTITLES_API_KEY as a Render secret — never commit it (this repo had one leaked in history; rotate it).
Built by Muhammad Zubair — Clinical psychologist → AI builder. Part of an AI-specialist portfolio.