How to Download Youtube Video

mysoomro
  6 years ago
  27

 

In this tutorial I'll show you how to download youtube videos using youtube-dl

 


 

First you have to install youtube-dl with this command

 

sudo apt-get install youtube-dl

and give in your password

 


 

To download a video

1- Go to youtube and search the video you want to download

2- Copy the Video URL from the browser's navigation(address) bar (As shown in the image)

3- Open up terminal and type in

 

youtube-dl {video URL}

~ Don't forget to replace '{video URL}' with the URL you copied from the browser's navigation(address) bar:
 
and your video will start downloading
 
~ But this will download video in some format that you don't want or it might be too heavy
 
For downloading video in format of your choice type in following
 

youtube-dl -F  {video URL}

~ Don't forget to replace '{video URL}' with the URL you copied from the browser's navigation(address) bar; as shown in the image below:

 

4-  If you choose to download video in format of your choice. you have one last step to follow: that is choosing the format of your choice.

When you type in the command for downloading video with format or your choice it'll give you list of different options, showing the formats and resolutions of that video.

choose the code of one you like and type in following:

 

youtube-dl -f  {format code} {video URL}

~ Don't forget to replace '{formate code}' with code of your choice and '{video URL}' with the URL you copied from the browser's navigation(address) bar; as shown in the image below:
 
 
 
In the example shown in the image above. I've chosen video in flv format with resolution [240*400] and its code is '5' as you can see in the image.

Easy...  Isn't it?? smiley
All the best!! yes
Comments
Poetician 2 months ago

When I downloaded a video using 18 as the format code, there was a portion of the URL appended to the file name. Made the file unplayable - no audio and a black window. I cleaned up the file name and the video works fine.


pravlinux 2 years ago

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package youtube-d1

as I'm a beginner I don't know what is this happening


twolf 2 years ago

Deb distribution package for youtube-dl is often outdated (it is currently and that version doesn't work anymore).
In the FAQ "How do I update youtube-dl?" reported in the url below it is suggested to manually install the program so you can then easily keep it updated:

https://github.com/rg3/youtube-dl/blob/master/README.md#faq

I did it and fixed my problem.


gamers4177 2 years ago

can it pause download? if yes, how to continue download again?


cotechinho 2 years ago

Thanks!


chico34 3 years ago

thanks


eldadxl 3 years ago

Great stuff!
How do I change the destination folder other than downloads folder?


abinashdash17 4 years ago

can i print the download link to a file?


RicardoMazeto 4 years ago

You can do it without have to install nothing.

1 - Go to youtube mobile version.
2 - press f12 (open the developer tools).
3 - ctrl+shift+c and hover the play button (to inspect the element).
4 - click the play button (inspect).
5 - click the play button again, this time to get the link.
6 - the link to your video is at the element at the developer tools panel.

just copy the link and paste at your player or download manager.


Glasairman 4 years ago

so far, so good, the https-file was load to the /home/[username] folder from YouTube Germany.

Can I change the target folder to download to my own Video folder?


mysoomro 5 years ago

@bkjaya1952 you are right! There are many other ways do download youtube videos too. You'll also find video download helper in chromium and google chrome.
And when Linux buffers the video it actually saves the video somewhere in its program files. You just have to copy it somewhere else in the hard drive. But it's a bit hard to find it in the program files.


bikrgran 5 years ago

I have just done this, using the -f 18 for MP4. As far as I can tell, it downloaded fine. I just can't FIND it! Where did it download it TO? Thanks for the tutorial. I took a chance on your -f codes being correct, as nothing came as a list. I'm using Mint 16 and Konsole (bash).


UmerButt 5 years ago

It does not work for youtube anymore because Youtube doesn't allow to download videos from their site anymore :(


teXew 5 years ago

Very easy and very fun to do trough terminal,thanks!


ericvictor66 5 years ago

Great! Works fine and very easy! Thank you for this!


alle83 5 years ago

Didn't work selecting the format, said "HTTP Error 404 not found"; when I didn't put the -F command, it worked. Wonder why?


efthialex 6 years ago

@mysoomro Nice tutorial!

@Tonya Thanks for the tip!


linux_boy 6 years ago

Very helpful way to download youtube vids. Thanks for this very nice tutorial. :)


sunewbie 6 years ago

Minitube does not work with all videos.

@Tonya and @mysoomro , thanks for tutorial and tips :)


mysoomro 6 years ago

@dalcde: haven't tried minitube yet. Just saw reviews for it. Many say it doesn't work on Linuxmint 13. Have you tried it on Maya?


dalcde 6 years ago

Minitube is better.


Tonya 6 years ago

@mysoomro:
Yes, sure, to download videos via terminal is a safe and proper way.
Thank you once again!


mysoomro 6 years ago

@Tonya:
Thanks Tonya! Your method is pretty simple and easy. I used a similar way, which was a website; www.keepvid.com. But last time I tried it, it wasn't working. So I searched this new method. And there was no tutorial for this on community site so I added one. :)


Tonya 6 years ago

Yes, nice and easy! Thank you for this tutorial!
It can be made as well without a terminal:
1) to type in the video URL "ss" before youtube... (for example, www.ssyoutube.com/watch?v=hJHkTxf72oM) and click Enter
2) to choose format you like and click Enter again
3) that's all - the video is in your Downloads folder.