How to make YouTube Video Downloader Application Using Python

Command version

This is just a two-line program actually but to explain it in a better way we have used the comments.

So, first, let’s see the two-line code to download any youtube video.

from pytube import YouTube

You can download the pytube module using “pip install pytube” but if this gives you the error then you should try “pip install pytube3” inside your terminal.


from pytube import YouTube
link = input("Enter the link ")
print("Video downloaded successfully")


Enter the link –
Video downloaded successfully

GUI Version

Library installation part is same so no need to discuss again. Lets dive into the code part.

# importing tkinter
from tkinter import *
# importing YouTube module
from pytube import YouTube
# initializing tkinter
root = Tk()
# setting the geometry of the GUI
# setting the title of the GUI
root.title("Youtube video downloader application")
# defining download function
def download():
    # using try and except to execute program without errors
        link.set("Video downloaded successfully")
    except Exception as e:
        link.set("Enter correct link")

# created the Label widget to welcome user
Label(root, text="Welcome to youtube\nDownloader Application", font="Consolas 15 bold").pack()
# declaring StringVar type variable
myVar = StringVar()
# setting the default text to myVar
myVar.set("Enter the link below")
# created the Entry widget to ask user to enter the url
Entry(root, textvariable=myVar, width=40).pack(pady=10)
# declaring StringVar type variable
link = StringVar()
# created the Entry widget to get the link
Entry(root, textvariable=link, width=40).pack(pady=10)
# created and called the download function to download video
Button(root, text="Download video", command=download).pack()
# running the mainloop


Note : This article is for personal record only, whenever i found something useful i share it to my site and the users who use it so i can get the code whenever i want. i dont have to remembers the multiple site for searching same code in future.

2 thoughts on “How to make YouTube Video Downloader Application Using Python”

Leave a Comment

Your email address will not be published. Required fields are marked *