The first video downloaded successfully with a recently updated version of youtube-dl which I installed with python-pip using python pip install youtube-dl
inside a Python virtual environment (python-virtualenv). For information about how to setup and use a Python virtual environment see How to set up and use a virtual python environment in Ubuntu?.
The command I used to show the available video formats was:
youtube-dl -F "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
The command I used to download the first YouTube video was:
youtube-dl -f 18 "https://www.youtube.com/watch?v=wo6Sq1h2DI4"
The second video could not be downloaded using youtube-dl, but I did not give up. I upgraded my youtube-dl to the latest version by running:
pip install --upgrade youtube-dl # inside the Python virtual environment
I didn't need to use sudo
because my Python virtual environment was installed inside my own user directory (~/my-Python-virtual-env
). After upgrading youtube-dl I ran this command to download the second YouTube video:
youtube-dl -f 18 "https://www.youtube.com/watch?v=BbbhZl8xqVY"
Why not simply use sudo pip install --upgrade youtube-dl
?
One of the reasons I use Ubuntu is to escape the madness of the way Windows installs applications. I install packages from the default Ubuntu repositories whenever possible. In this case I know that youtube-dl is a Python program, so I can locally install the latest version of youtube-dl in a Python virtual environment without messing up my filesystem.
Another alternative is to install the youtube-dl snap package:
sudo snap install youtube-dl # start with snap run youtube-dl
I believe that since from now some things have changed in YouTube's service and applications' way to access it.
True. Google has been changing the way to access YouTube videos more frequently now than was the case three years ago, so in order to keep youtube-dl up-to-date, it has to be updated more frequently too. I have observed over the years that YouTube videos appear to be blocked mostly related to the date when they were uploaded.
Before I started using youtube-dl, I used a Firefox extension called Video DownloadHelper to download YouTube videos. I have come to prefer youtube-dl because it has the highest probability of successfully grabbing YouTube videos of any downloader that I have ever used.
Best Answer
Shortcuts
If all of the videos are in the same playlist or the same channel, you can save time by using the following shortcuts.
Playlist
...where
<url-of-playlist>
is replaced by the URL of the playlist and replaceFORMAT
with any available video format, for example18
. You can use the-F
option to see all valid formats like this:Download part of a playlist from start of batch to end of batch
...where
<url-of-playlist>
is replaced by the URL of the playlist, replaceFORMAT
with any available video format, for example18
, andNUMBER
is the number of the video in the playlist to start/end downloading at.Channel
...where
<url-of-channel>
is replaced by the URL of the channel and replaceFORMAT
with any available video format, for example18
.Videos not in the same playlist or channel
First create a batch file which is a text file containing a list of URLs of videos from YouTube that you want to download. The URLs should be arranged in a list having only one URL and nothing else on each line, with a new line for each URL in the list. Save the batch file with a name that is easy to remember like batch-file.txt. If the multiple files are all on the same playlist, channel or user webpage in YouTube, you can generate a text file with a list that has all the links on that page by running the following command:
From the terminal run:
This is the basic command, however you also need to add the formats of the videos that you want to download or else you may find yourself downloading videos with formats that you didn't want. So first simulate your download to see if the format you want is available:
If the video format is not available you will get an error message that says:
requested format not available
. If the video format is available you will not get any error message when you use the--simulate
option. You can also add the -F option to see all valid formats like this:In the third command I have used the common flv 360p video format:
-f 34
. You might prefer to try the flv 480p video format by using-f 35
. So after you have added the video format that you want to the command, the command becomes something like this:Notes:
I didn't add the
--simulate
option to the last command, so this command would be executed for real.