The youtube-dl is a command line tool that allows to download videos from YouTube and other websites. The list of all the supported websites can be found in official website. The youtube-dl is a cross-platform tool which requires the Python interpreter.
This tutorial shows how to install youtube-dl on Raspberry Pi.
Install youtube-dl
Connect to Raspberry Pi via SSH. Use Curl tool to download youtube-dl to the /usr/local/bin
directory. Then add read and execute permissions for user, group, and others.
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
The youtube-dl is available for all users as youtube-dl
command. We can check version:
youtube-dl --version
We can run the following command to update youtube-dl to the latest version:
sudo youtube-dl -U
Testing youtube-dl
Now we can test. To download the video from website, use this command:
youtube-dl <VIDEO_URL>
The <VIDEO_URL>
is a video URL that you want to download. For example:
youtube-dl https://www.youtube.com/watch?v=C0DPdy98e4c
In most cases youtube-dl works fine without external dependencies. However, if you want to convert video/audio you will need to install FFmpeg. You can read post how to install it.
You can use -x
option to convert video files to audio only files. It requires FFmpeg.
youtube-dl -x https://www.youtube.com/watch?v=C0DPdy98e4c
Uninstall youtube-dl
If you decided to remove youtube-dl then execute the following command:
sudo rm -rf /usr/local/bin/youtube-dl
The 2 Comments Found
Note: You need ffmpeg on your pi to make youtube-dl work.
FFmpeg is an optional dependency. Some operations requires it.
Leave a Comment
Cancel reply