Skip to content


Youtube-dl is a command-line program to download videos from YouTube and other video sites. yt-dlp is a youtube-dl fork. Some examples on how to use youtube-dl or yt-dlp to download videos. In most cases commands for youtube-dl are the same as for yt-dlp. IN case of issues e.g. with "-F" output to give format selection create yt-dlp.conf in the same dir as yt-dlp and write --list-formats-old in it. If the command line is not appealing to you, try youtube-dl-gui which is a cross platform front-end GUI for youtube-dl.

What Where
Windows choco install yt-dlp
Linux apt install yt-dlp
Python pip install yt-dlp

Download Video

Download as MP4

yt-dlp.exe -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" 'link'

Download to a specific location in best quality:

yt-dlp.exe -f 22 -o 'path' 'link'

Download with details:

yt-dlp.exe -f best --write-description --write-info-json --write-annotations --write-sub --write-thumbnail 'link'

To download all videos mentioned on a given website use the following regex to find youtube links:

Regex for videos: youtube\.com\/watch\?v=[A-Za-z0-9-_]{11} Regex for playlists: youtube\.com\/playlist\?list=[A-Za-z0-9_-]{34}

We can now curl the given page (example here is and append all found links to download.txt

curl -s | grep -ioE "youtube\.com\/watch\?v=[A-Za-z0-9]{11}" > download.txt
curl -s | grep -ioE "youtube\.com\/playlist\?list=[A-Za-z0-9_-]{34}" >> download.txt

To download all videos and playlists listed in download.txt we can now run the following command. This will also put all playlist videos in an own subfolder:

yt-dlp.exe --batch-file download.txt -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' "${line}"

Audio only

yt-dlp.exe -i --extract-audio --audio-format mp3 --audio-quality 0 'link'

This script will download the latest yt-dlp.exe version for windows to the current folder if not available.

Function ytdlpl
    Param ($playlist)
    # Download and rename playlist
    yt-dlp.exe -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' -i --extract-audio --audio-format mp3 --audio-quality 2 --yes-playlist "$playlist"
    Set-Location -Path ((Get-Location).Path + "\" + (Get-ChildItem | Sort-Object LastWriteTime | Select-Object -last 1).Name)
    Get-ChildItem | Rename-Item -NewName { ($_.BaseName -replace '[^a-zA-Z]', ' ') + '.mp3' }
    Get-ChildItem | Rename-Item -NewName { ($_.BaseName -replace '\s+', ' ') + '.mp3' }
    Get-ChildItem | Rename-Item -NewName { ($_.Name -replace ' .mp3', '.mp3')}

YouTube Playlists

Download a playlist:

yt-dlp.exe -best 22 --yes-playlist 'link'

Download a playlist with audio only:

yt-dlp.exe -f 22 --yes-playlist 'link'

Get additional Video Information

Get Source formats available:

yt-dlp.exe --list-formats 'link'

Download subtitles:

yt-dlp --write-sub --sub-lang "en.*" --write-auto-sub --skip-download "link"