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
That's because you're up against YouTube which is huge and has servers all over the planet and they use them very efficiently to stream Terabytes of data!!!
If you really want to do this: don't remove any YouTube address from your IPtables; just keep adding them and to start, just go here for a list of YouTube IP addresses and add those all in. Check it weekly as they keep adding servers...
Fair warning: Some day, when you finally nailed down all of the YouTube servers, someone will show up at your desk and tell you: "Look, there's this educational video on how to install my printer/teach me math/... and I really need it!" and then you're going to pull out all of your hair and remove the blocks you've so painstakingly put in. (Your mileage may vary, though)
Edit: Additionally there might be circumstances where you actually block other Google services if you block huge ranges of YouTube IP addresses in IPtables or any other IP based filtering.