{"id":53,"date":"2017-01-16T14:07:50","date_gmt":"2017-01-16T18:07:50","guid":{"rendered":"http:\/\/notebook.chaopricha.com\/?p=53"},"modified":"2018-07-09T18:05:20","modified_gmt":"2018-07-09T22:05:20","slug":"installing-youtube-dl-on-windows-subsystem-for-linux-wsl","status":"publish","type":"post","link":"https:\/\/notebook.chaopricha.com\/?p=53","title":{"rendered":"Installing YouTube-DL on Windows Subsystem for Linux (WSL)"},"content":{"rendered":"<p>Please read my previous post on how to enable Windows Subsystem for Linux (WSL) on Windows 10. \u00a0You must have the Windows 10 anniversary update installed since WSL is not available on the original Windows 10.<\/p>\n<p>Youtube-dl is an awesome downloader for multimedia from the internet using a simple command line. \u00a0You can encode the video into a different format as well (namely FLV and MP4).<\/p>\n<p>Since Windows System for Linux doesn&#8217;t automatically install Python which is required for Youtub-dl to work correctly, you need to first install Python.\u00a0 You can install either Python 2.7x or Python 3.x.\u00a0 I installed Python 2.7x since most libraries are more compatible with it.\u00a0 To install Python 2.7x, open up your Ubuntu Bash window, and type in this command:<\/p>\n<pre>sudo apt-get install python\r\n<\/pre>\n<p>If you are adventurous and want to try Python 3, then use this command:<\/p>\n<pre>sudo apt-get install python3\r\n<\/pre>\n<p>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.<\/p>\n<p>There are many ways to install youtube-dl, here are the 2 common ways:<\/p>\n<p><b>Using apt-get<\/b><br \/>\nOpen up your Ubuntu Bash window, and type in this command:<\/p>\n<pre>sudo apt-get install youtube-dl\r\n<\/pre>\n<p>After the installation is done, run an update<\/p>\n<pre>sudo youtube-dl -U\r\n<\/pre>\n<p><b>Using Pip<\/b><br \/>\nFirst you have to install Pip<\/p>\n<pre>sudo apt-get install python-pip python-dev build-essential \r\n<\/pre>\n<pre>sudo pip install --upgrade pip \r\n<\/pre>\n<pre>sudo pip install --upgrade virtualenv \r\n<\/pre>\n<p>Now you can install youtube-dl with pip using this command:<\/p>\n<pre>sudo pip install youtube_dl\r\n<\/pre>\n<p>Then upgrade with Pip<\/p>\n<pre>sudo pip install --upgrade youtube_dl\r\n<\/pre>\n<p>If you try to do a video download (Master of the House song from Le Miserable) from youtube, you&#8217;ll get a bunch of errors.<\/p>\n<pre>sudo youtube-dl -o LeMiserableMasterHouse.MP4 \"https:\/\/youtu.be\/TWlzFbmZZHU\"\r\n<\/pre>\n<p>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:<\/p>\n<pre>sudo curl -L https:\/\/yt-dl.org\/latest\/youtube-dl -o \/usr\/local\/bin\/youtube-dl\r\n<\/pre>\n<p>Then set permissions:<\/p>\n<pre>sudo chmod a+rx \/usr\/local\/bin\/youtube-dl\r\n<\/pre>\n<p>Now you shouldn&#8217;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.<\/p>\n<p>For more details on the commands and options for youtube-dl, please visit this URL:<\/p>\n<pre><a href=\"https:\/\/github.com\/rg3\/youtube-dl\/blob\/master\/README.md#readme\">https:\/\/github.com\/rg3\/youtube-dl\/blob\/master\/README.md#readme<\/a>\r\n<\/pre>\n<p>Enjoy downloading YouTube videos!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Please read my previous post on how to enable Windows Subsystem for Linux (WSL) on Windows 10. \u00a0You must have the Windows 10 anniversary update installed since WSL is not available on the original Windows 10. Youtube-dl is an awesome &hellip; <a href=\"https:\/\/notebook.chaopricha.com\/?p=53\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":40,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/posts\/53"}],"collection":[{"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=53"}],"version-history":[{"count":3,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/posts\/53\/revisions"}],"predecessor-version":[{"id":104,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/posts\/53\/revisions\/104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=\/wp\/v2\/media\/40"}],"wp:attachment":[{"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notebook.chaopricha.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}