Skip to content

A NestJS-based REST API wrapper for yt-dlp that provides programmatic access to YouTube video metadata, subtitles, and information extraction with Swagger documentation.

License

Notifications You must be signed in to change notification settings

andranikarakelyan/yt-dlp-api

Repository files navigation

License Node.js CI

yt-dlp-api

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.

⚠️ This project uses yt-dlp, which may be used to download content from third-party services like YouTube. Use it responsibly and ensure you comply with the terms of service of the content provider.

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

Installation

# 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

Running the Application

# Development mode
npm run start:dev

# Production mode
npm run build
npm run start:prod

Once the application is running, you can access:

API Documentation

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.

API Endpoints

All endpoints are prefixed with /v1/yt-dlp.

Get yt-dlp Version

GET /v1/yt-dlp/version

Returns the installed version of yt-dlp.

Get Video Information

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.

Download 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.

Project Structure

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

License

MIT

About

A NestJS-based REST API wrapper for yt-dlp that provides programmatic access to YouTube video metadata, subtitles, and information extraction with Swagger documentation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published