Skip to main content

YouTube-DL - Download videos from YouTube and other sites in your terminal

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.

Comments

Post a Comment

Your input is valued. Please type something....

Popular posts from this blog

Fun Terminal Commands Every Linux User Should Try

Accessing Maps from the terminal with MapSCII Requirements Telnet installed Internet Connection Firewall is disabled You can do this on Linux, Unix, Mac OS X or Windows with an app like PuTTY or the Windows 10 Linux bash shell or any Os that supports telnet. Open terminal and write the command below. telnet mapscii.me Hit enter and you're ready to browse and enjoy MapSCII. Navigate using the keyboard or mouse. Use the following keys on your keyboard Arrow keys: up, down, right, left A to zoom in Z to zoom out C toggles ASCII mode on/off You can also click and drag and hold on the map with your cursor. If your connection dropped without a reason, reconnect with telnet -E mapscii.me and use only cursors, A and Z to navigate. The Mapscii project is open source and you can install it locally if you'd like. Check out their project here on GitHub . The Dancing ASCII Party Parrot Requirements Curl installed Internet

SQL for Data Analysis - Udacity

  Entity Relationship Diagrams An  entity relationship diagram  (ERD) is a common way to view data in a database. Below is the ERD for the database we will use from Parch & Posey. These diagrams help you visualize the data you are analyzing including: The names of the tables. The columns in each table. The way the tables work together. You can think of each of the boxes below as a spreadsheet. What to Notice In the Parch & Posey database there are five tables (essentially 5 spreadsheets): web_events accounts orders sales_reps region You can think of each of these tables as an individual spreadsheet. Then the columns in each spreadsheet are listed below the table name. For example, the  region  table has two columns:  id  and  name . Alternatively the  web_events  table has four columns. The "crow's foot" that connects the tables together shows us how the columns in one table relate to the columns in another table. In this first lesson, you will be learning the bas

Impressive - Check if Your Email Address Has Been Hacked - Free,Easy Tutorial

haveibeenpwned.com Data breaches are rampant and many people don't appreciate the scale or frequency with which they occur. A "breach" is an incident where data is inadvertently exposed in a vulnerable system, usually due to insufficient access controls or security weaknesses in the software. How is the legitimacy of a data breach established? Attackers often give "breach" announcements, which are later revealed to be hoaxes. There is a delicate balance to be struck between making data searchable as soon as possible and conducting proper due diligence to confirm the breach's validity. In order to verify the authenticity of a violation, the following steps are normally taken: Has the affected provider made a public statement about the security breach? Does the information stolen in the breach show up in a Google search (i.e., it was simply copied from another source)? Is the structure of the data consistent with what you'd expect to see in a breach? Have