Platform guide
How to download YouTube videos with yt-dlp
YouTube is what most people install yt-dlp for. A plain URL works for a quick grab, but the questions that actually come up are specific: how do I get the best-quality MP4, audio only, subtitles, a whole playlist, or a video that needs a login — and why does it suddenly fail with a "Sign in to confirm you're not a bot" error? Here are the exact commands, all run on yt-dlp 2026.10.26.
Quick answer
yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"That downloads the best pre-merged file yt-dlp can get without any extra work. Everything below is just telling it to do something more specific.
Best-quality video as a clean MP4
The highest-resolution video and audio on YouTube are usually separate streams, so you merge them. This needs ffmpeg installed:
yt-dlp -f "bv*+ba/b" --merge-output-format mp4 "YOUTUBE_URL"To cap the resolution instead of always taking the maximum (useful for 1080p over a huge 4K file), sort by height:
yt-dlp -S "res:1080" --merge-output-format mp4 "YOUTUBE_URL"More on picking streams in the format selection guide.
Audio only (MP3)
Extract and convert to MP3 in one step (also needs ffmpeg):
yt-dlp -x --audio-format mp3 "YOUTUBE_URL"Full walkthrough in extract audio as MP3.
Subtitles, including auto-generated captions
Most YouTube videos only have automatic captions, so use --write-auto-subs to catch those too. This grabs English subtitles without downloading the video:
yt-dlp --write-auto-subs --sub-langs en --skip-download "YOUTUBE_URL"To burn them into a download instead, swap --skip-download for --embed-subs. See the full subtitles guide.
Age-gated, members-only and signed-in videos
If a video needs you to be logged in — age-restricted, members-only, or private-to-you — pass cookies from a browser where you are signed in to YouTube:
yt-dlp --cookies-from-browser chrome "YOUTUBE_URL"Swap in firefox, edge or safari. Details and the common pitfalls are in the cookies guide.
"Sign in to confirm you're not a bot" — the YouTube-specific failure
This is the error that breaks YouTube downloads more than anything else, and it's not your command — it's YouTube's bot detection. Two things fix the overwhelming majority of cases:
- 1. Update yt-dlp. YouTube changes its extraction regularly and a stale build fails fast. See how to update.
- 2. Pass cookies from a logged-in browser with
--cookies-from-browser, as above.
If it still fails, work through the full fix for the bot-check error, the HTTP 403 / SABR guide, and player-client selection.
Playlists, SponsorBlock and metadata
A playlist or channel URL downloads every video by default — see the playlists guide for selecting ranges and keeping runs organized. Two YouTube extras people reach for:
# strip sponsor and self-promo segments
yt-dlp --sponsorblock-remove sponsor,selfpromo "YOUTUBE_URL"
# keep title, uploader, chapters etc. in the file
yt-dlp --embed-metadata --embed-thumbnail "YOUTUBE_URL"On a server or in an agent? Expect to get blocked
The same command that works on your laptop often fails from a cloud VM, CI job or agent sandbox: YouTube blocks datacenter IP ranges, so you hit the bot check even with a fresh yt-dlp. Cookies help for a while, but a personal cookie jar on a shared server is fragile. If you're running this server-side, start with yt-dlp blocked on a server and the run-on-a-server guide.
Servers & agents
Works on your laptop but not on the server?
Paste a link to see what a hosted API returns, running from servers and agent sandboxes where datacenter IPs get blocked — nothing to install or maintain on the box.
Building this into an app? See the API your backend calls instead
The mistake to avoid
Don't debug a YouTube failure before you've updated yt-dlp. More "broken" YouTube reports come down to a stale build than to anything else, because the extractor changes often. Update first, then troubleshoot.