How To Make a YouTube Video Downloader in Python | PyTube

The goal of this tutorial on How To Make a YouTube Video Downloader in Python is to download any kind of video in a quick and easy way from YouTube in your gadget.

This Youtube Video Downloader In Python is developed using Python TKinter Graphical User Interface (GUI), This Youtube Downloader Python is an application to download recording videos from YouTube.

Project Name:YouTube Downloader in Python
Language/s Used:Python (GUI) Based
Python version (Recommended):2.x or 3.x
Database:None
Type:Python App
Developer:IT SOURCECODE
Updates:0
How To Make YouTube Video Downloader in Python

This gives clients/users to download recording videos they need in their gadgets and watch them when they have not internet connection.

For this python project the user has to copy the youtube video URL that they want to download and simply paste that URL in the ‘paste link here’ section and click on the download button, it will start downloading the video. When video downloading finishes, it shows a message ‘downloaded’ popup on the window below the download button.

Live Sketch OpenCV Python With Sour...
Live Sketch OpenCV Python With Source Code | Free Python Projects with Source Code

This article also includes a downloadable Python Source Code for free, just find the downloadable source code below and click to start downloading.

To start Creating a YouTube Video Downloader, make sure that you have Pycharm IDE installed in your computer.

By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list of Best Python IDE for Windows, Linux, Mac OS that will suit for you. I also have here How to Download and Install Latest Version of Python on Windows.

Steps on How To Create Youtube Video Downloader Using Python With Source Code

Time needed: 5 minutes.

How To Make a YouTube Video Downloader Using Python With Source Code

  • Import Libraries.

    First, start the project by importing the required modules.

    *pip install tkinter
    *pip install pytube

  • Create Display Window.

    Second, create a GUI interface using Tkinter.
    How To Create Youtube Video Downloader Using Python display window

  • Create Field to Enter Link.

    Third, create a field for the link that get in youtube. The next thing we would do would be to ask the user for the link to the YouTube video we need to download. After that, the user will give us the link to the video he wants to download.
    field to enter link

  • Create Function Button to Start Downloading

    Fourth, create a functioning button to run the code and start downloading functionality.
    How To Create Youtube Video Downloader Using Python function button

Code Explanations

1. Importing Libraries

Code:

#tkinter import

import tkinter
from pytube import YouTube

Explanation:

The code given above are the project libraries that required to import in your command line.

2. Design of the Project

Code:

#label root text

root = tkinter.Tk()

#entry root width

root.geometry('500x300')
root.resizable(0,0)
root.title("IT SOURCECODE Youtube Video Downloader")


tkinter.Label(root, text ='Youtube Video Downloader', font ='arial 20 bold').pack()

Explanation:

The code given above is the design of the project.

Code:

link = tkinter.StringVar()

tkinter.Label(root, text ='Paste Link Here:', font ='arial 15 bold').place(x= 160, y = 60)
link_enter = tkinter.Entry(root, width = 70, textvariable = link).place(x = 32, y = 90)

Explanation:

The code given above is the input field of the URL to be downloaded.

4. Function To Download The Video

Code:

#function to download video


def Downloader():
     
    url =YouTube(str(link.get()))
    video = url.streams.first()
    video.download()
    tkinter.Label(root, text ='DOWNLOADED', font ='arial 15').place(x= 180, y = 210)


tkinter.Button(root, text ='DOWNLOAD', font ='arial 15 bold', bg ='blue', padx = 2, command = Downloader).place(x=180, y = 150)



root.mainloop()

Explanation:

The code given above is the function to start downloading the video.

Complete Source Code

import tkinter
from pytube import YouTube

root = tkinter.Tk()
root.geometry('500x300')
root.resizable(0,0)
root.title("IT SOURCECODE Youtube Video Downloader")


tkinter.Label(root, text ='Youtube Video Downloader', font ='arial 20 bold').pack()




##enter link
link = tkinter.StringVar()

#youtube URL

tkinter.Label(root, text ='Paste Link Here:', font ='arial 15 bold').place(x= 160, y = 60)
link_enter = tkinter.Entry(root, width = 70, textvariable = link).place(x = 32, y = 90)



#function to download video


def Downloader():
     
    url =YouTube(str(link.get()))
    video = url.streams.first()
    video.download()
    tkinter.Label(root, text ='DOWNLOADED', font ='arial 15').place(x= 180, y = 210)


tkinter.Button(root, text ='DOWNLOAD', font ='arial 15 bold', bg ='blue', padx = 2, command = Downloader).place(x=180, y = 150)



root.mainloop()

Output

Downloadable Source Code Below.

I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.

Summary

With this project in python, we have successfully developed on How To Make YouTube Video Downloader in Python. We used the popular Tkinter library that used for rendering graphics. We use the pytube library to download videos from youtube.

Related Article Below

Inquiries

If you have any questions or suggestions about on How To Make a YouTube Video Downloader in Python, please feel free to leave a comment below.

3 thoughts on “How To Make a YouTube Video Downloader in Python | PyTube”

Leave a Comment