LinTut

Install Youtube-dl on Linux and How to Use it

Youtube-dl is the most important and useful open-source command-line tool for Linux system to download videos from websites like Youtube, Dailymotion, Facebook, Google video, yahoo and many similar sites. It developed on python based library, so python is essential to install or available to use Youtube-dl software.
The Youtube-dl application supports many operating systems to download web video, including Windows, Linux, and Mac.
Youtube-dl also supports resuming features for video download, when the download gets interrupted, It will again start from resuming point.

In this tutorial, we will learn how to install youtube-dl and how to use it on Linux operating system.

1. Install Youtube-dl on Linux from Python

You can install youtube-dl on Linux from python package repository. First you need to install the python package managerpip.

Debian/Ubuntu:     
# sudo apt install python-pip

CentOS:            
# sudo yum install python-pip

Fedora:            
# sudo dnf install python-pip

Arch Linux:        
# sudo pacman install python-pip

OpenSUSE:          
# sudo zypper install python-pip

Then install youtube-dl with pip:

# sudo pip install youtube-dl

Now the installation is completed.

2. Update or Remove YouTube-dl

Sometimes youtube-dl can’t download videos. For example, it can’t find any videos in a playlist, you can try upgrading to the latest stable version. Use the following command to update:

# sudo pip install --upgrade youtube-dl

Use this command to remove it from your OS:

# sudo pip uninstall youtube-dl

3. How to Download Videos From Youtube

Now, when youtube-dl is installed and working in your system, you can use the following command to check all available options with youtube-dl

# youtube-dl –h

To download a single video, just type youtube-dl in the terminal followed by the video URL. For instance:

# youtube-dl hhttps://www.youtube.com/watch?v=tAGnKpE4NCI

Youtube-dl has the capabilities to support more video formats such as MP4, 3GP, WebM, and FLV. You can check all the available video format for any video by using below command:

# youtube-dl -F https://www.youtube.com/watch?v=tAGnKpE4NCI

Its output will be like:

Setting language
 BlXaGWbFVKY: Downloading video webpage
 BlXaGWbFVKY: Downloading video info webpage
 BlXaGWbFVKY: Extracting video information
Available formats:
37      :       mp4     [1080x1920]
46      :       webm    [1080x1920]
22      :       mp4     [720x1280]
45      :       webm    [720x1280]
35      :       flv     [480x854]
44      :       webm    [480x854]
34      :       flv     [360x640]
18      :       mp4     [360x640]
43      :       webm    [360x640]
5       :       flv     [240x400]
17      :       mp4     [144x176]

Now, you can choose the format to download the video using the flag –f like below:

# youtube-dl -f 37 https://www.youtube.com/watch?v=tAGnKpE4NCI

To download a playlist, just append the playlist URL to youtube-dl, like this:

# youtube-dl https://www.youtube.com/playlist?list=PLJvQXRgtxlulwncoZD8DX1sdf7qGL2t7A

To download all videos from a user, type the following in the terminal:

# youtube-dl -ciw ytuser:username

Also, you can append the user’s YouTube URL to download all of the user’s videos.

# youtube-dl -ciw https://www.youtube.com/user/username

If you aren’t a native English speaker, you might want to download and embed subtitles in the videos.

# youtube-dl -ciw --write-auto-sub --embed-subs https://www.youtube.com/user/username

You need to install ffmpeg for this to work.

# sudo apt install ffmpeg -y


You can use the --proxy option to specify HTTP/HTTPS/SOCKS proxy like below.
# youtube-dl --proxy socks5://127.0.0.1:1080/ https://www.youtube.com/videourl

Conclusion

Now, you have learned to install youtube-dl successfully into your ULinux Operating system and uses of this tool. Now you are ready to download any video from youtube or youtube-dl supported sites.
If you have any doubt, problem in instalaltion or any feedback, feel free to leave a comment below.

See also: Download Youtube and other sites videos using Clipgrab

Exit mobile version