Simple, self-hosted REST API for extracting YouTube metadata and subtitles using yt-dlp.
A RESTful API wrapper for yt-dlp that enables programmatic access to YouTube data extraction features.
- Video Information: Extract detailed metadata from YouTube videos
- Subtitles: Download subtitles in various formats
- Version Info: Check the installed yt-dlp version
- Interactive Documentation: Explore and test the API using Swagger UI
# Clone the repository
git clone https://github.com/andranikarakelyan/yt-dlp-api.git
# Navigate to project directory
cd yt-dlp-api
# Install dependencies (this will also download the latest yt-dlp binary)
npm install# Development mode
npm run start:dev
# Production mode
npm run build
npm run start:prodOnce the application is running, you can access:
- API at: http://localhost:3000
- Swagger documentation at: http://localhost:3000/api
The API is documented using Swagger. You can explore and test all endpoints interactively by visiting the Swagger UI at /api when the server is running.
All endpoints are prefixed with /v1/yt-dlp.
GET /v1/yt-dlp/version
Returns the installed version of yt-dlp.
POST /v1/yt-dlp/info
Request body:
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}Returns detailed information about the video including title, description, channel details, and available subtitles.
POST /v1/yt-dlp/subtitles
Request body:
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"language": "en",
"format": "vtt"
}Returns the subtitle file as a downloadable stream.
yt-dlp-api/
├── bin/ # Contains the yt-dlp binary
├── src/ # Source code
│ ├── main.ts # Application entry point
│ ├── app.module.ts # Root module
│ └── yt-dlp/ # YouTube downloader module
│ ├── dto/ # Data Transfer Objects
│ ├── yt-dlp.controller.ts
│ ├── yt-dlp.module.ts
│ ├── yt-dlp.service.ts
│ └── yt-dlp.types.ts
├── test/ # End-to-end tests
└── tmp/ # Temporary files directory