Make your Youtube downloader using python

So here we will see how we can make youtube video downloader application using python , so for this we will use two packages

  1. Pytube
  2. tkinter

So here we will use pytube package to download the video and tkinter for creating the UI for the application.

We will divide our code in three parts:

In first part we will import the required packages and after that we will make UI for the application , at the end we will define the function which will download the video

So let get started

STEP no1. 

Before importing packages we have to install both packages in our system so for that we need to open terminal and type below commands

pip install pytube

pip install tkinter

So now we need to open python file

from tkinter import *

from pytube import  YouTube

Here we have imported both packages

Now we will see the second step

STEP no. 2

Here we are going to create UI

root = Tk()#


Label(root, text = “YOUTUBE VIDEO DOWNLOADER APPLICATION”, font = “arial” ).pack()

Label(root, text = “Please paste your link”, font = “arial” ).place(x = 160, y = 50)

link = StringVar()

our_link = Entry(root, width = 60, textvariable = link ).place(x = 20 , y = 90)

Button(root, text = ‘DOWNLOAD’, font = “arial” ,command = youtubeDownloader).place(x=180, y =150)


So in first line we have initialized tkinter for creating window

And we have created two label and one Entry , in Entry we will paste our youtube link , here we have make variable link which will store our youtube video link which we will pass in youtubeDownloader function so that will download that video

So now the final step where we will just define the function which will download the video

STEP no. 3:

def youtubeDownloader():

   given_url = YouTube(str(link.get()))

   video = given_url.streams.first()

   Label(root , text = “video is downloaded”, font = “arial”).place(x= 180, y = 100)

here is first line we have converted our link into string format and than downloaded that video after that it will show “Video is downloaded” as we have created one label

Full code

Here our output:

Keep learning !!

Leave a Reply

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