Day 13: YouTube Video Downloader GUI In Python

Welcome to Day Thirteen of my 21-day project series!

Today I made a YouTube Video Downloader GUI In Python.

This will help us save all our favorite YouTube videos permanently

Do read the experience

Project Contents

This mini-project is a YouTube Video Downloader GUI In Python.

This is a very very simple video downloader that has only 2-3 widgets. Also, it is not implemented in OOP

And I have used customtkinter for GUI.

The project looks like this:

YouTube Video Downloader GUI In Python

Full Source Code

Here’s the full source code of the YouTube Video Downloader GUI In Python.

from customtkinter import *
from pytube import YouTube

def Download():
    """
    Function to download YouTube videos based on the provided link.
    """
    link = inp_link.get()
    try:
        # making object of the YouTube class from pytube
        youtubeObject = YouTube(link)
        # setting resolution to best
        youtubeObject = youtubeObject.streams.get_highest_resolution()
        # downloading the video
        youtubeObject.download()
        # clearing input widget after the download is successful
        inp_link.delete(0, 'end')
        # providing successfully downloaded message to the user provinding the location of video
        label = CTkLabel(app, text="The video's Download is completed successfully. You can check it in the same directory.")
        label.grid(row=2, column=0, columnspan=2)

    except Exception as e:
        # displaying errors if any
        label = CTkLabel(app, text=e)
        label.grid(row=2, column=0, columnspan=2)
    
# creating a GUI window
app = CTk()
# getting the link
inp_link = CTkEntry(app, placeholder_text="Enter your link here: ")
inp_link.grid(row=0, column=0, columnspan=2, padx=10, pady=10)
# button to download the video at the given link
download = CTkButton(app, text="Download", command=Download)
download.grid(row=1, column=0, columnspan=2, padx=10, pady=10)
app.mainloop()

This YouTube Video Downloader GUI In Python is well documented read the code to understand it.

Here are the links to topics within the mini-project. You can check them if you have any doubts or confusion:

Possible Improvements (That I’ll add after 21 days)

So, there are a lot of possible improvements in the YouTube Video Downloader GUI In Python:

Because I have made it in a super hurry. To know more about why so continue reading…

Experience of the day

In case you don’t know this project is a part of the brand new series that I have started. #21days21projects in python. To read more about it you can check out this page.

And for those who already know here’s my experience of the day.

Today again, I made this project in a hurry.

Why? Because I was so busy.

In what? Nothing really. You know it seems like I have so many things to do, I do a lot, and yet nothing happens.

I am so damm confused about what’s really going on that I actually forget what I was doing. It’s really an unpleasant state.

Am I alone in this? Or do you guys experience the same? Do let me know…

About the project. I literally couldn’t come up with any ideas today. Seems like I am out of ideas by now. Coder’s block maybe…😉😅

I felt like quitting today. Really everything.

But, then I thought that all of this has happened before and journaling regularly solved it previously.

I have decided to get on it again. And yes a new enhanced version of this website is coming soon… So stay tuned.

Do let me know whether you liked this YouTube Video Downloader GUI In Python. Also, let me know if there are any suggestions.

And most importantly how was your DAY 13?

Busy yet unproductive??

Well, I hope it was fun. And remember it’s perfectly awesome if you missed out. Continue to work from tomorrow.

And today just write one line of code as simple as making a variable or printing something.

Your suggestions are welcomed!

Happy coding…

And wait, if you have some ideas for the upcoming projects do let me know that too. Even when the series ends do let me know what you like…

Leave a Reply