Skip to main content
Custom extractors allow you to add support for new websites or modify existing extractors in yt-dlp.

Extractor Basics

Extractors are classes that inherit from InfoExtractor and implement the _real_extract method to extract video information from URLs.

Minimal Extractor Example

Required Fields

Every extractor must define:

Class Attributes

string
required
Internal name for the extractor (auto-generated from class name if not provided)
regex
required
Regular expression matching the URLs this extractor can handle

Return Dictionary

The _real_extract method must return a dictionary with at least:
string
required
Unique video identifier
string
required
Video title (use empty string if unavailable, not None)
string
Direct video URL (required if formats not provided)
array
List of format dictionaries (required if url not provided)

InfoExtractor Base Class

From yt_dlp/extractor/common.py:107-116:

Common Metadata Fields

Basic Information

Format Dictionaries

When providing multiple formats:

Additional Metadata

Helpful InfoExtractor Methods

Downloading Content

Extracting Data

URL Handling

Advanced Features

Handling Multiple Videos (Playlists)

Extracting HLS/DASH Formats

Authentication

Geo-restriction Handling

Testing Your Extractor

Adding Test Cases

Running Tests

Registering Your Extractor

As a Plugin

Create a plugin package (recommended):
See Plugin System for installation details.

Contributing to yt-dlp

To contribute your extractor to the main repository:
  1. Add your extractor to yt_dlp/extractor/
  2. Import it in yt_dlp/extractor/_extractors.py
  3. Follow the contributing guidelines

Best Practices

Use Helper Methods

Leverage InfoExtractor’s built-in methods instead of reimplementing common functionality.

Handle Errors Gracefully

Use default parameters and try-except blocks to handle missing data.

Provide Multiple Formats

When possible, extract all available quality options and let yt-dlp’s format selection handle the rest.

Add Comprehensive Tests

Include test cases for different video types, edge cases, and error conditions.

Common Patterns

Extracting Embedded JSON Data

Handling Age-Restricted Content

Working with Timestamps