DEV Community

Cover image for Youtube Video Downloader Application in Python
Trilochan Parida
Trilochan Parida

Posted on

Youtube Video Downloader Application in Python

You need to install pytube package to download youtube videos

pip3 install pytube

Then run below code and your youtube downloader is ready.

from tkinter import *
from pytube import YouTube
import ssl

ssl._create_default_https_context = ssl._create_unverified_context

canv = Tk()
canv.geometry("400x350")
canv.title("Youtube Video Downloader")
Label(canv, text="Welcome to Youtube Downloader!!!").pack()
lvar = StringVar()
lvar.set("Enter the Youtube Video URL")
Label(canv, textvariable=lvar).pack()
url = StringVar()
Entry(canv, textvariable=url, width=30).pack(pady=10)

def download():
    try:
        lvar.set("Downloading...")
        canv.update()
        YouTube(url.get()).streams.first().download()
        lvar.set("Video Downloaded Successfully")
    except Exception as e:
        lvar.set("Error: " + str(e))
        canv.update()

Button(canv, text="Download", command=download).pack()

canv.mainloop()
Enter fullscreen mode Exit fullscreen mode

If any doubt, please comment below.

Watch the full course on Python: https://www.youtube.com/playlist?list=PLpzY0hUPKIeeRj3jOdC2YRD_MfCtBgDEe

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Implement features, document your code, or refactor your projects.
Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

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

Okay