ShinTube API
YouTube Data API with yt-dlp
Project Overview
A FastAPI backend that uses yt-dlp to provide a RESTful API for downloading videos, fetching video metadata, search results, playlists, channels, comments, and subtitles from YouTube.
ShinTube API is a high-performance, asynchronous backend service built with Python and FastAPI. It acts as a wrapper around the powerful `yt-dlp` library to expose YouTube's publicly available data through a clean, well-documented RESTful API. The project is containerized with Docker for easy setup and deployment, and it's designed with a modular and scalable structure to simplify maintenance and future enhancements, while being fully configurable via environment variables, allowing for flexible customization and deployment options.
Project Stats
Key Features
- Download/Stream YouTube videos directly
- Search YouTube videos with pagination
- Get comprehensive video, playlist, and channel details
- Fetch video comments and subtitles
- High-performance asynchronous support
- Automatic interactive API documentation (Swagger UI)
- Containerized with Docker for easy deployment
- CORS enabled for easy frontend integration
- Clean, modular, and scalable structure
- Easily configurable and customizable
Technologies Used
Technical Implementation
My technical contributions to this project include (but may not be limited to):
- Built a high-performance FastAPI backend using asyncio to orchestrate non-blocking yt-dlp subprocesses for efficient data retrieval.
- Designed a modular Service-Layer Architecture that strictly separates API routes, business logic, and utility functions for enhanced maintainability.
- Implemented custom data parsing logic to transform raw, unstructured yt-dlp JSON output into clean, strictly typed RESTful API responses.
- Engineered a robust Error Handling system with custom exception classes mapped to precise HTTP status codes for reliable client feedback.
- Integrated loguru for advanced structured logging with rotation and retention policies for better observability.
- Implemented advanced IP-based rate limiting using slowapi to prevent abuse and ensure fair resource usage.
- Added in-memory caching using cachetools to speed up repeated requests and reduce load on the server.
- Fully configurable via environment variables, allowing seamless adjustments to settings without code changes.
- Containerized with Docker for simple, consistent deployment across any environment.