from pytube import YouTube
def download_Video(yt):
# filter mp4 streams from object
my_streams = yt.streams.filter(file_extension='mp4',only_video=true)
for streams in my_streams:
# print itag, resolution and codec format of Mp4 streams
print(f"Video itag : {streams.itag} Resolution : {streams.resolution} VCodec : {streams.codecs[0]}")
# enter the itag value of resolution on which you want to download the video
input_itag = input("Enter itag Value : ")
# get video using itag vale
video = yt.streams.get_by_itag(input_itag)
# finally download the YouTube Video...
video.download()
print("Video is Downloading as",yt.title+".mp4")
link = "Enter Your Link Here"
# Create YouTube Object.
yt = YouTube(link)
# call The function..
download_video(yt)