youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.6, 2.7, or 3.2+, and it is not platform specific. It should work on your Unix box, on Windows or on macOS. It is released to the public domain, which means you can modify it, redistribute it or use it however you like.
Youtube-dl allows one to download videos from YouTube and a few other similar sites such as DailyMotion, Facebook, Google Video and many more.
youtube-dl added video download support for 17 new websites: brightcove.com, auengine.com, RingTV, instagram.com, Jukebox, 3sat, CSpan, Statigr.am, traileraddict.com, hotnewhiphop.com, wat.tv, tu.tv, gamespot.com, tudou.com, Wimp.com, archive.org and break.com.
This tool also allows you to choose video quality you wish to download in from those available. But if not specified, youtube-dl will download the highest quality video from the site you're downloading from. It also supports user specific playlist downloads as well as options to add custom titles or leave original titles for the downloaded video files. It also has proxy support.
Installation
Download instructions for all distributions can be found here.
Ubuntu, Linux Mint, Debian
Download and install the latest youtube-dl version from the webupd8 PPA.
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install youtube-dl
If you don't wish to add any third party repositories, you can install it directly using curl or wget command using the following commands.
sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
After downloading the script, set executable permission using the following command:
sudo chmod a+rx /usr/local/bin/youtube-dl
Fedora, RHEL/CentOS
Youtube-dl can be installed by enabling the epel repository in your system.
Enable the epel repository using this guide.
Afterwards, you can install it using the yum package manager.
yum install youtube-dl
If you don't wish to install third party repository, you can install it directly using curl or wget command as shown below:
curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
Important
You system must have curl installed and wget enabled to be able to fetch the latest version of youtube-dl. You can use yum to install them on Fedora.
After fetching the file, set execute permission and run it using the following command:
chmod a+rx /usr/local/bin/youtube-dl
Update YouTube-dl
To update youtube-dl run the following command
youtube-dl -U
This is the output you expect
How to use youtube-dl to download videos
To download videos from YouTube or any of the supported sites, run the following command in your terminal:
youtube-dl video-url
where video-url is the url of the video you wish to download. For example
youtube-dl https://www.youtube.com/watch?v=NDUM3Iaxin4
To list all the available formats of the video, use the -list-formats option with the youtube-dl command. Use it as shown below
youtube-dl --list-formats https://www.youtube.com/watch?v=NDUM3Iaxin4
Download preferred file format
There are different file formats available including mp4, webm, m4a, 3gp, flv and more. To download a preferred file format, use the -f option which represents the video format code as seen in the image above. For example, if you would like to download a video in webm format, the video format code will be 248. Type in the command as follows to download:
youtube-dl -f 248 https://www.youtube.com/watch?v=NDUM3Iaxin4
To download a list of videos at once, create a text file and place all the YouTube links of the videos you wish to download. For example. My text file will be called youtube_vidlinks.txt. Use the command below to download them.
youtube-dl -a youtube_vidlinks.txt
To see all the available options that can be used with youtube-dl, type in the following command in your terminal:
youtube-dl --help
Configuration
You can configure youtube-dl by placing any supported command line
option to a configuration file. On Linux and macOS, the system wide
configuration file is located at /etc/youtube-dl.conf
and the user wide configuration file at ~/.config/youtube-dl/config
. On Windows, the user wide configuration file locations are %APPDATA%\youtube-dl\config.txt
or C:\Users\<user name>\youtube-dl.conf
. Note that by default configuration file may not exist so you may need to create it yourself.
Note that options in configuration file are just the same options aka switches used in regular command line calls thus there must be no whitespace after -
or --
, e.g. -o
or --proxy
but not - o
or -- proxy
.
You can use --ignore-config
if you want to disable the configuration file for a particular youtube-dl run.
You can also use --config-location
if you want to use custom configuration file for a particular youtube-dl run.
For more information about this command-line tool, visit their GitHub page.
If you encounter any issues with the youtube-dl tool, feel free to leave a comment below and I will get back to you.
this is some cool stuff and is what i have been using
ReplyDelete