"Don't trust the cloud. Use it, enjoy it, exploit it, but don't believe in it. Or even the web for that matter. Many people assume that the web —and its riches—will always be there waiting for you. It won't. Don't bookmark. Download. Hard drives are cheap. Fill them up with everything you think you might need to consult, watch, read, listen to, or cite in the future. Your local library should be more vast than anything up for offer on the web. Please understand that the web and its treasures are temporary and ephemeral; that Deleuze PDF that you bookmarked yesterday very well may not be there tomorrow." Kenneth Goldsmith
Note, Nov 2020: The RIAA temporarily managed to temporarily take down the official repository in October 2020 for alleged copyright infringements. As many observers have noted, yt-dlp
is a legitimate tool with a world of a lawful uses. Because of the attention the RIAA generated, the project is more alive than ever.
There are all kind of websites that offer to extract audio or video from YouTube, or other streaming sites, but really all you need is yt-dlp
. It’s a command line utility, so it operates via typing in commands into the Terminal.
These are instructions for Mac, written up in January 2019 and last updated November 2021, when they were changed to recommend yt-dlp
as a tool. This is a fork of the original youtube-dl, which has not been updated for a long time and must be considered stale. Windows users please download the binary from here. If you're on Linux you probably know how to find out yourself.
If you don't know where the Terminal is, open it by searching for it via Spotlight. The command line is actually really cool, because it’s The Most Direct Way™ to interact with a computer (here’s a tutorial for getting started if you need more hand-holding. Also my own workshop notes from 2017). It's really very simple, and dates back 40 or more years, to when there wasn't a graphical interface. You type in a command and confirm with the Enter
key. Try ls
to list files. Bang, you get a direct response. There are already more than a thousand commands built in to your Mac, but we’re going to install two new ones.
So please fire up Terminal, paste this line here (yes, those lines with a grey background are Terminal commands), and hit Enter
:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You will be prompted for your computer password. This installs Homebrew, a piece of software that allows you to easily install standard Open Source command line utilities on Macs. We’re going to use it to install yt-dlp
.
This might take a few minutes. Once that's done, enter brew install yt-dlp/taps/yt-dlp
Do a brew update
if it fails. Then try again and let Brew do its thing. That's all. To test it, type in the first few characters of yt-dlp
and hit the tab key. Terminal should autocomplete the command. Now yt-dlp
only needs to be told to download where from. You need to give it an argument.
yt-dlp
can download audio and video from over a thousand different sites. The most basic usage is
yt-dlp any_URL_with_a_video_file_embedded
I.e.
yt-dlp https://www.youtube.com/watch?v=4N8oOj_aue8
Note that this will download files into your Home folder, because this is where you always are when Terminal opens. You can show the home folder in Finder (if you're on a Mac, that is) by hitting "shift + cmd + H". Or just browse to the folder that has a little house as an icon.
Question: Can you figure out by which rules the files are named? Tip: you can reconstruct the URL from the file name.
yt-dlp
will by default always download the best available quality file.
If you're looking for something specific, you can find out what other formats of a file are available with the -F flag.
yt-dlp https://www.youtube.com/watch?v=4N8oOj_aue8 -F
will produce something like this:yt-dlp https://www.youtube.com/watch?v=4N8oOj_aue8 -f 140
Pro-tip: You don't need to type in all those commands again. Once is enough. Just use the arrow-up key to find previously used Terminal commands. Modify them as you like and hit Enter
to run.
There are literally too many options to remember. To name a few:
Instead of a single video you can provide the URL of a playlist, which will download all videos on that list:
yt-dlp https://www.youtube.com/playlist?list=PLQqYRGYVdbVliPvdqruHQ6ksbjRrSzTG
To make it even more automatic/fail-safe, add the -ciw flags:
yt-dlp -ciw https://www.youtube.com/playlist?list=PLQqYRGYVdbVliPvdqruHQ6ksbjRrSzTG
The flags stand for:
-c Force resume of partially downloaded files. By default, yt-dlp will resume downloads if possible.
-i Continue on download errors, for example to skip unavailable videos in a playlist
-w Do not overwrite files
You can provide a text file with URLs (one URL per line) with the --batch-file flag (also throw in the -ciw flags for good measure): yt-dlp -ciw --batch-file=my_list_of_URLs.txt
You can include passwords (i.e. to archive your protected Vimeo files): yt-dlp --video-password "password here" "vimeo url here"
(enclosing quotes are optional and neccessary only if password or URL contain spaces or other special characters).
Some sites require a login, in which case you can provide a copy of the browser cookie. It's a little more complicated, though. Happy to explain if anyone needs that.
In some cases you might want to change the format into something else, i.e. to convert video+audio files to audio-only files. In that case you'll also need ffmpeg, which is easily installed, again using brew, which we already used to install yt-dlp
: brew install ffmpeg
.
See post-processing to find the exact command suited to your taste.
And here's where yt-dlp
really shines. Note that in in the screenshot above (again, just as an example) the default, "best available quality" file is not the highest resolution file that actually comes with both video and audio. There is another, higher res version, format no 308 - but it's "video only". If you have ffmpeg installed, yt-dlp
will notice and automatically download the best quality "video only" and "audio only" formats, and merge them into a new, best possible quality file.
Note that you won't be able to directly download DRM-protected streams, like Netflix or Amazon Prime.
If the domain you're trying to download from is not in the list of supported sites, yt-dlp
will still try to fall back to a default method to extract the file.
If that doesn't work you might have to try other ways. ctrl
-clicking on a video that plays may still give you the option to directly save that video, at least in Firefox. Sometimes it's only shift+ctrl
-clicking that gives you that option.
If it doesn't work, on YouTube itself, or another known compatible site: Update yt-dlp
on a Mac with brew upgrade yt-dlp/taps/yt-dlp
. When that doesn't work, try to do it manually with sudo yt-dlp -U
If it's just YouTube you need to download from, use this privacy-friendly way to access it, which also gives you a download link directly in your browser. No need to install anything: Invidious Instances (choose any of the listed links)
Some sites don't work with yt-dlp
. In these cases a browser plugin like Video DownloadHelper might help.