Coders Packet

Video Downloader in Python using Pytube and Tkinter

By Archisman Bhattacharya

This code helps you develop a basic video downloader in python using pytube and Tkinter. This downloader allows you to download any YouTube video.

Version and module used:

Python 3 (this code has been written in Python3.9)




There are times when we want to download a youtube video, but the online tools spam us with too many ads.

Here we will learn to build a basic video downloader using python library pytube.

Once we are done with building the basic downloader, we will then use Tkinter to develop a basic GUI for our use.

Video Downloader GUI

We first need to enter the save location for the file. This requires us to enter the enter save directory. Then we need to enter the video URL. Clicking on the 'Download' button starts the download process. In order to access YouTube and download a video we use the pytube library which is imported as follows:

from pytube import YouTube

We then use pytube to access YouTube and get back all possible streams. Among all available streams, there are two streams that have both audio and video. We try to download any one of the two using 'itag'.

The downloaded file gets stored at our given location.

We use Tkinter To design a basic GUI in order to make navigation simpler.


Download Complete Code


No comments yet