YouTube Video Downloader with Python

YouTube video Downloader with Python using Pytube module

If you want the youtube video downloader code then join our telegram

Python YouTube Video Downloader is a python application to download videos from YouTube with its link. This provides users to download videos they have on their devices and watch them offline.

Youtube Video Downloader Python Project

The Youtube downloader project is a python project, the objective of this project to download any category of video in a fast and straightforward way from youtube on your device.

In this python project, a user has got to copy the youtube video URL that they need to download and easily paste that URL within 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.

youtube video downloader with python

Steps to Develop Python YouTube Downloader


To implement this project we use the essential concept of python, Tkinter, pytube library.

Tkinter is a standard GUI library and it’s one of the simplest ways to create a GUI application.
pytube used for downloading videos from youtube
To install the specified modules run the pip installer command on the command line:

pip install Tkinter
Pip install pytube

These are the subsequent steps to create a youtube video downloader project in python :

Pseudo code:

Import libraries
Creating shopwindow
Create a field to enter the link
Create a function to start out downloading

1. Import Libraries

Start the project by importing the specified modules.

from tkinter import *
from pytube import YouTube

In this python project, we import tkinter and pytube modules.

2. Create windows

root = Tk() 
root.title(" video downloader") 
  • Tk() used to initialize tkinter to create display window
  • geometry() used to set the window’s width and height
  • resizable(0,0) set the fix size of window
  • title() used to give the title of window
Label(root,text = 'Youtube Video Downloader', font ='arial 20 bold').pack()
  • Label() widget use to display text that users can’t able to modify.
  • root is the name of the window
  • text which we display the title of the label
  • font in which our text is written
  • pack organized widget in block

3. Create Field to Enter Link

link = StringVar()

Label(root, text = 'Paste Link Here:', font = 'arial 15 bold').place(x= 160 , y = 60)
link_enter = Entry(root, width = 70,textvariable = link).place(x = 32, y = 90)
  • link is a string type variable that stores the youtube video link that the user enters.
  • Entry() widget is used when we want to create an input text field.
  • width sets the width of entry widget
  • textvariable used to retrieve the value of current text variable to the entry widget
  • place() use to place the widget at a specific position

4. Create Function to start out Downloading

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

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


Join Telegram channel to get the code : channel Name: resolvemyquery

Url variable gets the youtube link from the link variable by get() function and then str() will convert the link in string datatype.

The video is download in the first present stream of that video by stream.first() method.

Button() widget wont to display button on the window.

  • text which we display on the label
  • font during which the text is written
  • bg sets the background color
  • command is employed to call the function
  • root.mainloop() is a function that executes once we want to run the program.

Python YouTube Downloader Output

youtube video downloader with python


With this project in python, we’ve successfully developed the youtube video downloader project using python. We used the favored Tkinter library that used for rendering graphics. We use the pytube library to download videos from youtube.

If you want to make a automate the whatsapp messages with python checkout this article

Leave a Comment