Youtube video downloader with Tkinter UI python project

Published on . Written by

Youtube video downloader with Tkinter UI python project

Python is a high-level general-purpose programming language which is used for various applications. Using python you can make a web application, desktop application, Games, etc. In this python project, we will discuss how to download youtube videos using python and also we will create a nice UI using the Tkinter library.


Skyfi Labs Projects
Youtube is a widely used video-sharing platform downloading a video from youtube is a hectic task. To download a video you need to copy and paste the link to another site or you need to install an extension which will display unwanted ads. To avoid all the headaches and also to develop your programming skill I will show you how to download a youtube video.

Read more..

SLNOTE
Let’s get started.

First, download and install the latest version of Python 3 in your computer or laptop. We are going to use “pytube” which is a python library. Python libraries make the programming task easier which allows you to access the program which is already implemented to save lots of time. It is a collection of functions and methods which allows you to code fast. Pytube is a very useful dependency-free library used to download videos from the web.

The best way to install the library is by using pip. PIP refers to Preferred Installer Program which is used to install additional libraries and packages easily using the command line. PIP comes pre-installed with Python 3.4 or greater versions. If you don’t have pip installed, you can download and install pip from this site (https://www.knowledgehut.com/blog/programming/what-is-pip-in-python).

To check the version of pip installed in your computer, open command prompt and type the following command - pip --version then press enter.

Let’s begin the project

import tkinter as tk   #importing tkinter library

from pytube import YouTube #importing the pytube library

def downloadVid():

global E1

string=E1.get()

yt= YouTube(str(string))

videos = yt.get_videos() #this will return a list to choose the video quality

s=1

for v in videos:

print(st(s)+’.’+str(v))

s+=1

n=int(input(“Enter your choice”))

vid = videos[n-1]

destination=str(input(“Enter your destination”))

vid.download(destination)

print(yt.filename+”\n is downloaded”)


SLLATEST
root=tk.Tk() #initializing root component

w=tk.Label(root,text=”Youtube Downloader”) #widget creation

w.pack()

#entry box is created to past the link

E1=tk.Entry(root,bd=5)

E1.pack(side=tk1.TOP)  #it is organized using pack function

#Button is created so the program is triggered when it is pressed

button=tk.Button(root,text=”Download”.fg=”red”,command=downloadVid )

button.pack(side=tk.BOTTOM)

#When the button is clicked whatever the function inside the command will be executed in our case the command is to download the youtube video.

root.mainloop()

Now you can run the program and it will start the application and asks you to put the URL in the box. Copy and paste the URL then it will ask you to choose the video quality and give the download location for the video to be saved. Now you can able to see the video is downloaded.


SLDYK
Kit required to develop Youtube video downloader with Tkinter UI python project:
Technologies you will learn by working on Youtube video downloader with Tkinter UI python project:


Any Questions?


Subscribe for more project ideas