How To Make A YouTube Video Downloader With Python

Youtube video downloader with python
Table of Contents

Hello programmers today we I will show you how to make youtube video downloader with python you can have your own youtube video downloader you can download any youtube video.

It is very simple and easy to make with just like 10 lines of python code. We will use pytube python library to make this youtube video downloader. I will give you the source code for this project you can copy and paste so let’s start.

If you are intrested in more projects like this than do check my other projects as well at coderzway projects visit here – Coderzway Projects.

Making a youtube video downloader with python

So first inorder to create youtube video downloader with python you need to have python installed on your machine I know you must have python installed.

Install python

If you don’t have python installed you can install it from the python website here – Download Python. Remember to click add python to path while installing.

So now you have python installed let’s create youtube video downloader

Create a .py file

Go to any folder and create a python file with .py extension and open it with a code editor. I am using vs code you can use anything I will recommend you to use vs code it has lot of advantages you can download vs code from here – Download vs code.

Install pytube

So now you have created the file you need to install pytube library to install it open terminal or command prompt at your file location and do this

				
					pip install pytube
				
			

This will install pytube library in your project.

Copy and paste

Now you have installed everything final step is to copy and paste this code in your python file

				
					# This is a youtube video downloader made by coderzway

# First you need to install pytube
# You can do it by pip install pytube in command prompt
# Paste the link of a youtube video and wait for some time it will download
# It will take time to download big videos it depends on your internet

from pytube import YouTube

link = input('Enter a youtube video link : ')

url =YouTube(link)
print(f'{url.title} is downloading please wait...')
video = url.streams.first()
video.download()
print(f'Video downloaded check your folder you opened this file')
				
			

After this you can run this file by opening command prompt or terminal at the file location and type this in the command prompt

python filename.py

This will run the file

Output

Youtube video downloader with python

How to use

1 – Enter the url of the youtube video you can get the url by clicking share and copy the link
2 – Boom your video has just started downloading
3 – You will see the downloaded video in th folder where you created this project it can take some time to download the video it depends on your internet so wait.

So this was the youtube video downloader with python you can add more features to this you can check out pytube documentation.

Thank you for reading I hope you have found what you were looking for if you want more projects like this than subscribe to our newsletter.

Share This Post
Share on facebook
Share on twitter
Share on email
Share on whatsapp

Leave a Reply

Subscribe To Our Newsletter

Get updates and learn from the best

Latest Guides & Articles