Skip to content

yt-dlp (Youtube)

Download and extract data from youtube videos. yt-dlp is an actively maintained fork of the defunct yt-dl.

Deno Required

Recent updates to youtube require a complete javascript environment (Deno). Downloads will fail without it.

Install

Standalone binary is highly recommended as it can be updated inline as well as use direct git patching for fixes not released yet.

cd ~/.local/bin
wget -q0 yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux

yt-dlp --update  # Update to latest release.
yt-dlp --update-to 0xvd/yt-dlp-exp@generic-kvs  # Update to specific patch.
pacman -Ss yt-dlp yt-dlp-ejs
# Install yt-dlp
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o ~/.local/bin/yt-dlp
chmod a+rx ~/.local/bin/yt-dlp

# Install deno
curl -fsSL https://deno.land/install.sh | sh
echo 'export DENO_INSTALL="$HOME/.deno"' >> ~/.bashrc
source ~/.bashrc

# Confirm Deno is loaded
yt-dlp --verbose 2>&1 | grep "deno"

# Update releases
yt-dlp --update
sudo deno upgrade
# libav-tools may be required: Copy all dll/exe files from
# libav-tools/win64/usr/bin to location of yt-dlp.exe.
#
#   http://builds.libav.org/windows/release-gpl
winget install yt-dlp

Extract 320kbps MP3 Audio From Video

yt-dlp --extract-audio --audio-format mp3 --audio-quality 320K --keep-video --add-metadata {URL}

Extract FLAC Audio From Video.

yt-dlp --extract-audio --audio-format flac --audio-quality 0 --add-metadata {URL}

List all formats for a video and select the best ones.

yt-dlp -F {URL}
yt-dlp -f ###+### {URL}

Download only the 1080p video/audio stream from a video.

yt-dlp -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" {URL}

Download a playlist.

yt-dlp https://youtube.com/playlist?list={PLAYLIST ID} --yes-playlist

Track Downloaded Videos for Archiving.

# This downloads only videos not listed in file and adds any downloaded videos
# to the given file. Space downloads randomly to prevent blocking.
#
# File can be manually created after initial download by using naked site and
# id:
#
#   redgifs 1234567890abcef
yt-dlp {URL} --sleep-interval 10 --max-sleep-interval 30 --download-archive archive.md

Azure Media Services

These can be downloaded by forcing a m3u8 stream and downloading. This works for MS streaming videos and other services using Azure Media Service backends.

  1. ctrl + shift + i u2794 network ➔ all
  2. Load the video/stream page.
  3. Locate the manifest(format=...) URI in Chrome Dev Tools.
  4. RMB ➔ copy ➔ copy link address
  5. Use with yt-dlp changing manifest portion of the URI to manifest(format=m3u8-aapl-v3)

Reference123456