Installation
Install yt-dlp via pip:Basic Usage
The main entry point for using yt-dlp as a library is theYoutubeDL class:
Extract Information Without Downloading
You can extract video metadata without downloading the actual video file:Common Options
TheYoutubeDL class accepts a dictionary of options. Here are some commonly used options:
Video format code (e.g., ‘best’, ‘bestvideo+bestaudio’, ‘720p’)
Output filename template. Can be a string or dictionary with keys like ‘default’
Do not print messages to stdout
Do not print out anything for warnings
Continue on download errors. Can be ‘only_download’ to ignore only download errors
Do not resolve URLs or process playlist items. Can be ‘in_playlist’, ‘discard’, or ‘discard_in_playlist’
Simple Example
Information Dictionary
When you extract information, yt-dlp returns a dictionary containing video metadata. Common fields include:id: Video identifiertitle: Video titledescription: Video descriptionuploader: Video uploader nameduration: Video duration in secondsview_count: Number of viewslike_count: Number of likesformats: List of available formatsthumbnails: List of thumbnail dictionariessubtitles: Dictionary of available subtitles
Error Handling
Next Steps
YoutubeDL Class
Deep dive into the main YoutubeDL class and its methods
Extractors
Learn about the extractor system and how to work with different sites
Post-Processors
Process downloaded media with post-processors
Examples
Browse practical code examples for common use cases