This is just a two-line program but to convert it to GUI YouTube Video Downloader is a bit longer still, this program of GUI YouTube Video Downloader is less than 25 lines.
But still, if you want that two-line program then click here.
We have explained this program in every line to make it understand easily for you.
We have created two entry widgets, one to ask the user to enter the URL or link of a YouTube video and the other to add that link.
Then, we have called the download function using the “Download Video” button.
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.
Now, let’s see the code and understand.
# importing tkinter from tkinter import * # importing YouTube module from pytube import YouTube # initializing tkinter root = Tk() # setting the geometry of the GUI root.geometry("400x350") # 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 try: myVar.set("Downloading...") root.update() YouTube(link.get()).streams.first().download() link.set("Video downloaded successfully") except Exception as e: myVar.set("Mistake") root.update() 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 root.mainloop()
- Unveiling the Future of AI DetectorThe rise of AI (Artificial Intelligence) content creation tools, especially ChatGPT, Bard, Jasper, etc., has imposed multiple threats to academia and the search engine world. Now, many students and researchers spend less time on research. Instead, they create content from different AI tools, paraphrase them, find a few relevant studies, and submit them as their … Read more
- CodeWithHarry Earns 20 Lakhs per month from YouTube?CodeWithHarry is a YouTube channel owned by Haris Ali Khan, hailing from Rampur, Uttar Pradesh, India. In 2013, he embarked on his academic journey at the Indian Institute of Technology Kharagpur in West Bengal, where he pursued Industrial & Systems Engineering (ISE), a 5-Year Dual Degree Course. He initiated his YouTube channel on 28 April … Read more
- Cleaning Service Booking System in Python TkinterIntroduction Hello friends, in this article we will see a very simple cleaning service booking system in Python tkinter. This project can not be used in the real world, this just tries to mimic real-world online service applications and that’s why the features of this app are limited. In simple words, you can use this … Read more
- Farmers Ecommerce App using Python TkinterIntroduction Hello friends, I will show you how to create a simple e-commerce app for farmers using Python and the tkinter library in this tutorial. Before anything, let me tell you that this is not a real e-commerce app where anyone can list and buy products like we do on Amazon or Flipkart.Technologies used-> Python, … Read more
- Guidelines for Project Collaboration ProcessHi, Thanks for contacting Please send complete details about your project. Whatever features/requirements you want in your project/application/software, please write now, changes/updates later will/may not be entertained Necessary – Tell your budget Payments – You will need to pay according to milestones, let me explain. Let us say, there are 5 tasks in your project, … Read more