Welcome to my little node on the network! My name is Petar and you can follow along while I try to figure out how computers work.

Recent notes

Downloading YouTube videos with yt-dlp

yt-dlp is a powerful command-line tool for downloading videos from YouTube and other platforms. I frequently use it to save videos for offline viewing, particularly before long flights or to archive interesting content.

On macOS, you can install it using Homebrew:

brew install yt-dlp

Here’s the onfiguration that I use:

yt-dlp \
  --cookies-from-browser safari
  --format bestvideo+bestaudio
  --merge-output-format mp4
  -o "%(title)s.%(ext)s"

You can either supply these options through the command line or save them in a config file at ~/.config/yt-dlp/config. The config file format is straightforward - just list the flags one per line:

--cookies-from-browser safari
--format bestvideo+bestaudio
--merge-output-format mp4
-o "%(title)s.%(ext)s"

Once configured, downloading a video is as simple as:

yt-dlp https://youtube.com/watch?v=...

The video will download in the highest available quality and save to your current directory.

Permalink

Recent Posts

Running to think

For a few years now, I've been partaking in the age-old ritual of running. I began my journey like many others, swathed in quality athletic wear and armed with a meticulous training schedule...

Read more

Recent reads