GUI YouTube Downloader Using Python with Source Code

Introduction:

The GUI based Youtube Downloader is a mini project in python which helps one to learn the basics of creating the interfaces in python using tkinter. The Youtube is one of the most popular social media platforms where we can explore thousands of videos for a single concept. But when we want to store that video which is more comfortable to learn in offline device, we need to download them and they are available only on the cloud space provided by Youtube but this project is intended to save that Youtube video file permanently in our local system. So, let’s step into its implementation using python….

Source Code :

Get Discount on Top Educational Courses

Brand NameDiscount InformationCoupon Codes Link
Educative.io20% discount on Educative courses and plans
W3Schools20% discount on W3Schools courses
KodeKloud10% discount on KodeKloud courses and plans
GeeksforGeeks30% discount on GeeksforGeeks courses
Target Test Prep20% discount on Target Test Prep
Coding Ninjas₹5000 discount on Coding Ninjas courses
Skillshare40% discount on Skillshare
DataCamp50% discount on DataCamp
365 Data Science57% discount on 365 Data Science Plans
Get SmarterFlat 20% discount on Get Smarter courses
SmartKeedaFlat 40% discount on SmartKeeda courses
StackSocial20% discount on StackSocial courses
				
					#Import required Libraries
from tkinter import *
from pytube import YouTube

# Create Display Window
root= Tk()
root.resizable(0,0)
root.geometry('500x450')
root.configure(bg='red')
root.title('Youtube Downloader')

# Label which displays text on the GUI
Label(root,text='Youtube Video Downloader\n Enter Link to download video below...',font='arial 15 bold',bg='red',fg='black').pack()

# Background Image to be displayed on created GUI 
photo=PhotoImage(file="Youtube.png")
lbl=Label(image=photo).pack()

# Variable to store user entered link
link=StringVar()

# Create an entry field which accepts link from user
enter_link=Entry(root,width=70,textvariable=link).place(x=50,y=100)

# Function to download the user entered link
def downloader():
    # Getting the user entered link and assinigng it to YouTube class ini pytube
    url=YouTube(str(link.get()))
     # Returns the first element in list of video formats(320 px)
    video=url.streams.first()
    # The download starts here
    video.download()
    # To acknowledge user that the video has downloaded after it's completion
    Label(root,text='Dowloaded').place(x=215,y=390)
    
# Button to start the downloading the video of provided url
Button(root,text='Download Here',command=downloader,fg='white',bg='black').place(x=200,y=360)

# To start the interface and display the properties in it
mainloop()
				
			

Explanation:

1. Imported all the required libraries

tkinter – used to create GUI in python

pytube – which consists of Youtube class which is responsible of controlling the youtube videos using python

2. Created a root window with required specifications where all the content of our project is displayed 

3. Created a label and attached an image to it as background which consists of Youtube logo

4. Declared a variable which is used to store the user entered link and an entry box where user can enter his/her link to download the video.

5. Next created a downloader function which is responsible of downloading user entered link(if valid only)

6. Finally created a button when clicked the download of the video will begin.

Note:

-> The get the same output as I got first you need to download an image which consists of Youtube logo and store it your current directory (where you are running this program)

-> We used streams.first() in downloader function to get the video quality as 320 px by default even we can download highest resolution of video using  

streams.get_highest_resolution()

-> By defualt the youtube is downloaded in current working directory so when you want to download somewhere in your system specify the path in video.download() in downloader() function.

video.download(“specify_path”)

Output :

Find More Projects

Drawing Chhatrapati Shivaji Maharaj Using Python Chhatrapati Shivaji Maharaj, the legendary Maratha warrior and founder of the Maratha Empire, is an inspiration …

Resume Builder Application using Java With Source Code Graphical User Interface [GUI] Introduction: The Resume Builder Application is a powerful and user-friendly …

Encryption Tool using java with complete source Code GUI Introduction: The Encryption Tool is a Java-based GUI application designed to help users …

Movie Ticket Booking System using Java With Source Code Graphical User Interface [GUI] Introduction: The Movie Ticket Booking System is a Java …

Video Call Website Using HTML, CSS, and JavaScript (Source Code) Introduction Hello friends, welcome to today’s new blog post. Today we have …

promise day using html CSS and JavaScript Introduction Hello all my developers friends my name is Gautam and everyone is welcome to …