How to download YouTube videos using python for beginners - In this tutorial we will be using the pytube module in python to download videos from YouTube using a direct URL.

main.py

'''
YouTube Video Downloader
Author: Ayushi Rawat
'''

#import the package
from pytube import YouTube

url = 'Your URL goes here'
my_video = YouTube(url)

print("*********************Video Title************************")
#get Video Title
print(my_video.title)

print("********************Tumbnail Image***********************")
#get Thumbnail Image
print(my_video.thumbnail_url)

print("********************Download video*************************")
#get all the stream resolution for the 
for stream in my_video.streams:
    print(stream)

#set stream resolution
my_video = my_video.streams.get_highest_resolution()

#or
#my_video = my_video.streams.first()

#Download video
my_video.download()

Code Repository - https://github.com/ayushi7rawat/Youtube-Projects/tree/master/YouTube%20Video%20Downloader 
Repository for Ultimate Resource in python: https://github.com/ayushi7rawat/Ultimate-Python-Resource-Hub 

Subscribe: https://www.youtube.com/@AyushiRawat/featured 

#python

How to Download YouTube Videos using Python for Beginners
163.05 GEEK