Recently I discovered many articles on How to download Youtube videos on a Raspberry Pi with Raspbian operating system installed in it or other Linux based operating systems like Ubuntu, etc.

Not got a single article which shows how it works, although I tried 6 to 7 times (approx.) following the steps of certain articles and GitHub’s but didn’t work for me.

But somehow I got this cracked and while assuming that most of you have suffered from same difficulties or may have got certain errors or are willing to be able to download videos from several websites on your credit card sized computer (Raspberry Pi) or other Linux based systems, I am going to show you What is the correct way to install youtube-dl on your system.

youtube-dl is a small command-line program to download videos from YouTube.com and other sites that don’t provide direct links to the videos served.

youtube-dl allows the user, among other things, to choose a specific video quality to download (if available) or let the program automatically determine the best (or worst) quality video to grab. It supports downloading entire playlists and all videos from a given user.

If you want to know more about the supported sites, formats, and features. Check this Link to Debian

You can easily download videos of all formats and sizes at your desired quality using Youtube-dl.

Windows users can download a .exe file and place it in any location on their PATH except for %SYSTEMROOT%System32(e.g. do not put in C:WindowsSystem32).

To install it right away for all UNIX users (Linux, OS X, etc.), type:

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

If you do not have curl, you can alternatively use a recent wget:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

You can also use pip:

sudo -H pip install --upgrade youtube-dl

This command will update youtube-dl if you have already installed it. See the PyPI page for more information.

macOS users can install youtube-dl with Homebrew:

brew install youtube-dl

Or with MacPorts:

sudo port install youtube-dl

This command will update youtube-dl if you have already installed it.

To check the signature, type:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl.sig -O youtube-dl.sig
gpg --verify youtube-dl.sig /usr/local/bin/youtube-dl
rm youtube-dl.sig

After installing this you can download the video

youtube-dl <youtube URL>

If you want to download in mp4 or any specific format then  use the following option

format code extension resolution  note 
171         webm      audio only  DASH webm audio , audio@ 48k (worst)
140         m4a       audio only  DASH audio , audio@128k
160         mp4       192p        DASH video 
133         mp4       240p        DASH video 
134         mp4       360p        DASH video 
135         mp4       480p        DASH video 
136         mp4       720p        DASH video 
137         mp4       1080p       DASH video 
17          3gp       176x144     
36          3gp       320x240     
5           flv       400x240     
43          webm      640x360     
18          mp4       640x360     
22          mp4       1280x720    (best)

Errors:

I have installed youtube-dl using apt-get on Raspbian:
$ sudo apt-get install youtube-dl

The version is rather old (2012.02.27), so I decided to update it:

$ sudo youtube-dl --update
Updating to latest version...
Updated youtube-dl. Restart youtube-dl to use the new version.

Though it appears to have been a success, the result is this:

$ youtube-dl --version
/usr/bin/youtube-dl: line 1: Not: command not found

Turns out, the contents of /usr/bin/youtube-dl have been rendered rather useless during the update:

$ cat /usr/bin/youtube-dl
Not Found

The solution is quite simple for this error:

Which is to find – uninstall – and reinstall, but this time it must be in a different way.

Use the following commands to update:

sudo rm /usr/bin/youtube-dl  # or apt-get remove -y youtube-dl
sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
hash -r

Later you can enjoy downloading the videos by simply adding a few lines of codes as mentioned above.

Also, you can bundle download more than one video by copying their links to a .txt file and saving it, suppose xyz.txt name. For bulk download process you need to write:

youtube-dl -f 18 -a xyz.txt

You may also like: Introduction to Raspberry Pi


Like it? Share with your friends!

68 shares

What's Your Reaction?

hate hate
3
hate
confused confused
23
confused
fail fail
13
fail
fun fun
10
fun
geeky geeky
6
geeky
love love
30
love
lol lol
33
lol
omg omg
23
omg
win win
13
win
Thepiguy

0 Comments

Your email address will not be published. Required fields are marked *

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
List
The Classic Internet Listicles
Countdown
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Meme
Upload your own images to make custom memes
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
Gif
GIF format