DEV Community

Cover image for GUI Youtube video downloader using python, tkinter and pytube.
Technical Vandar
Technical Vandar

Posted on

3 2

GUI Youtube video downloader using python, tkinter and pytube.

here is the source code for GUI youtube video downloader with python

# GUI youtube video downloader using python, pytube, tkinter
from email import message
from tkinter import *
from tkinter import messagebox
from tkinter import ttk
from turtle import width
import pytube


# Creating window
window=Tk()
window.title("Youtube Video Downloader")
window.geometry("400x200")
window.resizable(0, 0)


labelframe=ttk.Frame(window)
label=ttk.Label(labelframe, text="Youtube Video Downloader", font=('Arial', 20))
label.grid(row=0, column=0)
labelframe.grid(row=0, column=0, padx=25, pady=10)

centerframe=ttk.Frame(window)
urllabel=ttk.Label(centerframe, text="Enter Video Url: ")
text_box=ttk.Entry(centerframe, width=40)
download_button=ttk.Button(centerframe, text="Download Video")

urllabel.grid(row=0, column=0)
text_box.grid(row=0, column=1)
download_button.grid(row=1, column=1, pady=15)
centerframe.grid(row=1, column=0, pady=15)

def download_video():
    try:
        url=text_box.get()
        yt=pytube.YouTube(url)
        video=yt.streams.filter(only_video=True).first()
        video.download()
        messagebox.showinfo("Download Success", "Video Downloaded Successfully")
    except:
        messagebox.showerror("Error", "Please Enter Valid Url")

download_button.config(command=download_video)

window.mainloop()
Enter fullscreen mode Exit fullscreen mode

Final Output:
Image description

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay