Please read my previous post on how to enable Windows Subsystem for Linux (WSL) on Windows 10. You must have the Windows 10 anniversary update installed since WSL is not available on the original Windows 10.
Youtube-dl is an awesome downloader for multimedia from the internet using a simple command line. You can encode the video into a different format as well (namely FLV and MP4).
Since Windows System for Linux doesn’t automatically install Python which is required for Youtub-dl to work correctly, you need to first install Python. You can install either Python 2.7x or Python 3.x. I installed Python 2.7x since most libraries are more compatible with it. To install Python 2.7x, open up your Ubuntu Bash window, and type in this command:
sudo apt-get install python
If you are adventurous and want to try Python 3, then use this command:
sudo apt-get install python3
In the past when I tried having both versions, there are conflicts when trying to run Python codes. So I just pick one version and stick with it. I recommend using 2.7x for stability and comparability. Eventually Python 3 will be the best version but maybe give it a couple more years.
There are many ways to install youtube-dl, here are the 2 common ways:
Open up your Ubuntu Bash window, and type in this command:
sudo apt-get install youtube-dl
After the installation is done, run an update
sudo youtube-dl -U
First you have to install Pip
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
Now you can install youtube-dl with pip using this command:
sudo pip install youtube_dl
Then upgrade with Pip
sudo pip install --upgrade youtube_dl
If you try to do a video download (Master of the House song from Le Miserable) from youtube, you’ll get a bunch of errors.
sudo youtube-dl -o LeMiserableMasterHouse.MP4 "https://youtu.be/TWlzFbmZZHU"
From searching the web, I found that we need to do a bunch of permission settings to get the downloader to not error out due to things like Protocol error and such. Use this command first:
sudo curl -L https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
Then set permissions:
sudo chmod a+rx /usr/local/bin/youtube-dl
Now you shouldn’t have problem downloading videos from youtube. The video is downloaded to the directory where you issues the youteb-dl command. You can supply the extension of the file to be .FLV or .MP4 when downloading.
For more details on the commands and options for youtube-dl, please visit this URL:
Enjoy downloading YouTube videos!