How to download YouTube videos?….You may say by using apps such as VidMate, SnapTube, TubeMate etc etc…There are many apps available in the store. But no need, you can do that using Python with some 5-6 lines of code !!! Let us see how …….
So, First thing first install Pytube. You can easily download Pytube using PIP. Go to the command prompt and give a command pip install pytube . Pytube package will get installed.

Make sure you have PIP installed. If you don’t have PIP installed on your system you have to install PIP first, but if you are having Python 3.4 or higher ,then it is already there in your PC.
Step 2 : Copy the YouTube link.

Step 3 : Import pytube…and create a variable[url] and paste the desired YouTube video link. Give the command pytube.YouTube(url) in another variable[yt].

Step 4 : You can get all the streams available for that video, using the streams.all() function.


Step 5 : You can download those files using the ‘itag’. You can even download the Audio file and make it a ‘YouTube Video to Audio Converter’ program. We just only need the streams.get_by_itag() function, and give it a path where to download the file.


Here is your video….

Here is the code :
import pytube
url = ' ' #paste the link here
yt = pytube.YouTube(url)
'''
streams = yt.streams.all()
for i in streams:
print(i)
'''
video = yt.streams.get_by_itag(22)
video.download('C:/') #give it a path
print("*****Download Complete*****")
