YouTube Video Downloader

How to Build a YouTube Video Downloader using Python

How to Build a YouTube Video Downloader using Python

Hello coder, welcome to the codewithrandom blog. In this blog, we will walk you through building a YouTube video downloader using Python Programming with Complete Source Code. YouTube is the world’s largest video-sharing platform, and it offers billions of videos on various topics. Sometimes you might want to download a YouTube video to watch it offline or share it with someone who does not have an internet connection. In this blog, we will Build a YouTube video downloader using Python.

YouTube Video Downloader

Prerequisites

Before we start building our YouTube video downloader, you should have a basic understanding of Python and the following libraries:

  • pytube: a library for downloading YouTube videos
  • tkinter: a GUI library for building desktop applications

You can install these libraries using pip, a package manager for Python, by running the following command in your terminal:

pip install tkinter
pip install pytube

To Run the YouTube video downloader in Python , you can follow these steps:

Step 1: Import the required  libraries

from tkinter import *
from pytube import YouTube

 

Step 2: Create display window

root = Tk()
root.geometry('700x300')
root.resizable(0, 0)
root.title("YouTube Video Downloader")

Label(root, text='Copy the link of the video you want to download from YouTube',
      font='arial 15 bold').pack()


Step 3: Create field to enter link

link = StringVar()

Label(root, text='Paste Link Here:', font='arial 15 bold').place(x=270, y=60)
Entry(root, width=80, textvariable=link).place(x=32, y=90)

Step 4: Create function to start downloading

def Downloader():

    url = YouTube(str(link.get()))
    video = url.streams.first()
    video.download()
    Label(root, text='DOWNLOADED', font='arial 15').place(x=270, y=210)


Button(root, text='DOWNLOAD', font='arial 15 bold', bg='white',
       padx=2, command=Downloader).place(x=280, y=150)

root.mainloop()

Complete code here👇👇

from tkinter import *
from pytube import YouTube

root = Tk()
root.geometry('700x300')
root.resizable(0, 0)
root.title("YouTube Video Downloader")

Label(root, text='Copy the link of the video you want to download from YouTube',
      font='arial 15 bold').pack()

# enter link
link = StringVar()

Label(root, text='Paste Link Here:', font='arial 15 bold').place(x=270, y=60)
Entry(root, width=80, textvariable=link).place(x=32, y=90)

# function to download video


def Downloader():

    url = YouTube(str(link.get()))
    video = url.streams.first()
    video.download()
    Label(root, text='DOWNLOADED', font='arial 15').place(x=270, y=210)


Button(root, text='DOWNLOAD', font='arial 15 bold', bg='white',
       padx=2, command=Downloader).place(x=280, y=150)

root.mainloop()

OutPut👇👇👇

YouTube Video Downloader

 

Conclusion

Hurray! You have successfully Build a YouTube Video Downloader project using the Python Programming . We learned to create amazing python project. The program will open a window with an entry field to enter the YouTube video URL and a button to Download the download. Enter the URL of the video you want to download . Hope you enjoyed building with us! Visit our homepage and you get lot’s of projects💝

 

 

 



Leave a Reply