Setting up youtube-dl for downloading videos and MP3s from Youtube Videos, on macOS

Download and configure youtube-dl:
(Ref.: https://github.com/ytdl-org/youtube-dl)
(Requires ffmpeg pre-installed for the mp3 conversion to work).

Download the latest nightly into ~/youtube-dl and add proper aliases:
From https://github.com/ytdl-org/ytdl-nightly/releases/latest, download the latest "youtube-dl" file.
Now it was https://github.com/ytdl-org/ytdl-nightly/releases/download/2024.04.22/youtube-dl.

So doing this:
latestnightly="https://github.com/ytdl-org/ytdl-nightly/releases/download/2024.04.22/youtube-dl"
mkdir -p ~/youtube-dl
curl -L $latestnightly -o ~/youtube-dl/youtube-dl
echo 'alias youtube-dl="python3 ~/youtube-dl/youtube-dl"' >> ~/.zshrc
echo 'alias yt2mp3="python3 ~/youtube-dl/youtube-dl --extract-audio --audio-format mp3"' >> ~/.zshrc
source ~/.zshrc

Now to use this, just run the command 'youtube-dl'.

To download a youtube video, make sure you add double quotes around the URL, as in

  youtube-dl "" 

To download a video and convert it to mp3,

  ytmp3 ""

Add new comment

randomness