Install YouTube DL.py to Download YouTube Videos to Your PC

Youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.x (x being at least 5), and it is not platform specific. It should work on your Linux, Windows and Mac OS X system. It is released to the public domain, which means you can modify it, redistribute it or use it however you like. This article will cover the installation of the Python program script, youtube-dl in order to download YouTube videos directly to your PC.

  • Note: This article will cover the installation of the youtube-dl python script on Microsoft Windows and Ubuntu operating system.

Steps

  1. Download python and python script. This is necessary in downloading YouTube to your PC device.
    • Make sure you select the correct version of Python for your system architecture either 32-bit or 64-bit. If your PC has 4GB of memory or more it is most likely a 64-bit computer running a 64-bit operating system.
    • You can download Python from here Download Python.
  2. Change into the Downloads directory on your Windows PC.
  3. Click on the Python executable in order to install Python to your system. Once Python is installed onto your computer, you also have the option of installing python for use at the command line prompt in Windows by adding the location of Python installed on your system. For example, the PATH may or may not be.
    • ;C:\Python27;
  4. You will need to obtain the youtube-dl python script called youtube-dl.py. You can obtain the youtube-dl script from here: youtube-dl.
    • Make sure you download and save the youtube-dl python script as youtube-dl.py
  5. Once the Python script is downloaded you will need to configure your Windows system to run the youtube-dl.py Python script from the Windows command line.
    1. First, change into your C: drive in Windows and create a directory
    2. Open a command line prompt in Windows
    3. Type/Copy/Paste: cd /
      • This should change you into the C: drive, if not make sure you are in the C: drive
    4. Type/Copy/Paste: mkdir youtube-dl\bin
      • Create a directory to hold your youtube-dl Python script
    5. Type/Copy/Paste: cd Users\"your_user_name"\Downloads
      • To change into your Downloads directory
    6. Type/Copy/Paste: copy youtube-dl.py to C:\youtube-dl\bin
      • You may need to be Administrator on your system in order to create directories and copy files to system folders.
  6. In order to use the youtube-dl python script from the Windows command line you will have to edit and add the following line to your system PATH environment variables ;C:\youtube-dl\bin;
    • This will inform the Windows system to the location of the youtube-dl.py Python script. To edit your Windows system PATH environment variables you will have to perform the following steps.
    1. Click on the Start Button.
    2. Click on Control Panel.
    3. Click on System and Maintenance.
    4. Click on System.
    5. Click on Advanced System Setting.
    6. Click on Environmental Variables.
    7. Click on PATH to edit system wide variables.
    8. Click OK when finished.
    9. Type/Copy/Paste: ;C:\youtube-dl\bin;
      • Make sure you carefully edit your Windows System PATH and include the semi-colon ; before the letter C
  7. Once this task is complete you should be able to run the youtube-dl.py python script from the Windows command line prompt in any location.
    • For example, to download a YouTube video you would highlight/copy/paste the YouTube URL in the Windows terminal. It would look like this,
    • Type/Copy/Paste: youtube-dl.py https://www.youtube.com/watch?v=giNdyLY46Mo&feature=related
      • It will download the YouTube FLV or MP4 video to your PC. A correctly downloaded YouTube video file will have the following file format
      • giNdyLY46Mo.flv or giNdyLY46Mo.mp4, look for those file extensions which end in *.flv and *.mp4 and use the VLC multimedia player to play them.
  8. So in order to download a YouTube video to you PC you would:
    • Type/Copy/Paste: cd Videos
      • Change into you Videos directory or wherever you store videos or multimedia on your PC and perform the following tasks.
    • Type/Copy/Paste: youtube-dl.py “Paste the URL of the YouTube video here”
      • The YouTube video should download into your videos directory or whatever directory you are in when you issue the youtube-dl.py command.
  9. Youtube videos are usually stored in the FLV or MP4 formats and you can use a media player such as VLC player to view your videos. You can install the VLC multimedia player by going to the following link Download the VLC Player.

Ubuntu Linux Instructions:

  1. To install Python on your Ubuntu Linux, issue the following command:
    1. Type/Copy/Paste: sudo apt-get update
    2. Type/Copy/Paste: sudo -s apt-get install python
      • This will install Python to your Ubuntu Linux system
    3. Type/Copy/Paste: sudo -s apt-get install youtube-dl
      • This will install the youtube-dl script to your system
  2. So in order to use youtube-dl on Ubuntu Linux, issue the following command, and highlight/copy/paste the URL of the YouTube video:
    • Type/Copy/Paste: youtube-dl “Paste the URL of the YouTube video here”
    • For example, the usage of the youtube-dl python script on Ubuntu Linux would be used as the following example to download a YouTube video.
    • Type/Copy/Paste: youtube-dl https://www.youtube.com/watch?v=giNdyLY46Mo&feature=related
      • It will download the YouTube video to which ever directory you are currently in when you run the youtube-dl command.
      • A correctly downloaded YouTube video file will have the following file format
      • giNdyLY46Mo.flv or giNdyLY46Mo.mp4 look for those file extensions which end in *.flv and *.mp4 and use the VLC multimedia player to play them.
  3. YouTube videos are usually stored in the FLV or MP4 formats and you can use a media player such as VLC player to view your videos. You can install the VLC multimedia player by going to the following link Download VLC multimedia player or using the following commands on Ubuntu Linux.
    1. Type/Copy/Paste: sudo apt-get update
    2. Type/Copy/Paste: sudo -s apt-get install vlc
      • This will install the VLC multimedia player to your Ubuntu Linux system.

Tips

Updating

  • From time to time, you may need to upgrade the youtube-dl python script by issuing the following commands below. For example, if you find that youtube-dl is installed correctly and when you run the command you are not able to download the YouTube video. This means you need to upgrade youtube-dl on your PC by issuing the following command:
    • Type/Copy/Paste: youtube-dl -U
      • For Windows issue the above command to update the youtube-dl python script on Windows you have to be Administrator
    • Type/Copy/Paste: sudo apt-get update
    • Type/Copy/Paste: sudo -s youtube-dl -U
      • For Linux issue the above command to update the youtube-dl python script on Ubuntu Linux you have to be root

Warnings

  • May affect computer
  • Downloading monetized videos (videos with ads at the start) will mean that when you watch the video offline, the channel that posted the video will not receive any money. Take this into consideration when downloading videos.

You may like