Ytube API
An async FastAPI service for YouTube search, metadata and stream resolution that runs an embedded Deno runtime to evaluate signature challenges, with Redis token buckets in front.
- Project
- Media extraction service
- Language
- Python
- Started
- 2025-08
The story
Ytube API resolves search queries, metadata, playlists and direct stream URLs without an upstream API key. It runs at api.nubcoders.com and is public source.
The interesting constraint is that YouTube's player signature logic is JavaScript that changes without notice. Rather than chase it in Python, the service ships a Deno runtime and evaluates the real thing. That is more moving parts in the container and far fewer at three in the morning.
In front of that sits Redis, doing double duty as a metadata cache and a token-bucket limiter keyed per API token.
Under the hood
The decisions that make it work.
- Signature resolution
- An embedded Deno runtime evaluates YouTube's EJS challenges at request time, which is the part that breaks when you try to reimplement it in Python.
- Rate limiting
- Redis-backed token buckets enforce per-token daily extraction caps, so one client cannot exhaust the upstream budget for everyone.
- Control surface
- A Telegram admin bot issues tokens, adjusts limits and tails logs — no separate admin frontend to maintain.
- Deployment
- Docker Compose stack behind Traefik, running on the same box as the rest of the services.