Downlaod Youtube Video in Any Format Using Python Pytube Library

Hi Everyone, In this Post, We learn How we can Download Youtube Video in Any Format Using Python Pytube Library. We need to install the Python Pytube Library for Downloading Any Youtube Video.
We Complete this program with a few Steps,
- Import Pytube Library
- Get Youtube URL from User Input
- Print All Possible Format
- Input Path Where Save the Video
Complete Program
#import Library
from pytube import YouTube
print("Enter Youtube video url : ")
url = input()
print('Please Wait till a minute....')
yt = YouTube(url)
videos = yt.streams.all()
s = 1
for v in videos:
print(str(s)+ ". "+str(v))
s += 1
print("Enter the number of the video: ")
n = int(input())
vid = videos[n-1]
print("Enter the destination Path Where You want to save this File : ")
destination = input()
print('Please Wait till a minute....')
vid.download(destination)
print("\nYour File has been successfully downloaded")
1. [Stream: itag="18" mime_type="video/mp4" res="360p" fps="30fps" vcodec="avc1.42001E" acodec="mp4a.40.2" progressive="True" type="video"]
2. [Stream: itag="137" mime_type="video/mp4" res="1080p" fps="30fps" vcodec="avc1.640028" progressive="False" type="video"]
3. [Stream: itag="248" mime_type="video/webm" res="1080p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
4. [Stream: itag="136" mime_type="video/mp4" res="720p" fps="30fps" vcodec="avc1.4d401f" progressive="False" type="video"]
5. [Stream: itag="247" mime_type="video/webm" res="720p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
6. [Stream: itag="135" mime_type="video/mp4" res="480p" fps="30fps" vcodec="avc1.4d401e" progressive="False" type="video"]
7. [Stream: itag="244" mime_type="video/webm" res="480p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
8. [Stream: itag="134" mime_type="video/mp4" res="360p" fps="30fps" vcodec="avc1.4d401e" progressive="False" type="video"]
9. [Stream: itag="243" mime_type="video/webm" res="360p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
10. [Stream: itag="133" mime_type="video/mp4" res="240p" fps="30fps" vcodec="avc1.4d4015" progressive="False" type="video"]
11. [Stream: itag="242" mime_type="video/webm" res="240p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
12. [Stream: itag="160" mime_type="video/mp4" res="144p" fps="30fps" vcodec="avc1.4d400c" progressive="False" type="video"]
13. [Stream: itag="278" mime_type="video/webm" res="144p" fps="30fps" vcodec="vp9" progressive="False" type="video"]
14. [Stream: itag="140" mime_type="audio/mp4" abr="128kbps" acodec="mp4a.40.2" progressive="False" type="audio"]
15. [Stream: itag="249" mime_type="audio/webm" abr="50kbps" acodec="opus" progressive="False" type="audio"]
16. [Stream: itag="250" mime_type="audio/webm" abr="70kbps" acodec="opus" progressive="False" type="audio"]
17. [Stream: itag="251" mime_type="audio/webm" abr="160kbps" acodec="opus" progressive="False" type="audio"]
- First Enter Url Of Youtube Video
- Select the Number Which format you Want to Download
- Enter Path of Your Computer Where you want to Save this Video then wait till a Minte Your Video is Downloaded
Thanks for Reading Share this Post
Random Blogs
- Grow your business with Facebook Marketing
- How to Become a Good Data Scientist ?
- Career Guide: Natural Language Processing (NLP)
- Variable Assignment in Python
- Role of Digital Marketing Services to Uplift Online business of Company and Beat Its Competitors
- Transforming Logistics: The Power of AI in Supply Chain Management
- How AI Companies Are Making Humans Fools and Exploiting Their Data
- OLTP vs. OLAP Databases: Advanced Insights and Query Optimization Techniques
- Understanding AI, ML, Data Science, and More: A Beginner's Guide to Choosing Your Career Path
- The Ultimate Guide to Artificial Intelligence (AI) for Beginners
Prepare for Interview
Datasets for Machine Learning
- Ozone Level Detection Dataset
- Bank Transaction Fraud Detection
- YouTube Trending Video Dataset (updated daily)
- Covid-19 Case Surveillance Public Use Dataset
- US Election 2020
- Forest Fires Dataset
- Mobile Robots Dataset
- Safety Helmet Detection
- All Space Missions from 1957
- OSIC Pulmonary Fibrosis Progression Dataset
- Wine Quality Dataset
- Google Audio Dataset
- Iris flower dataset
- Artificial Characters Dataset
- Bitcoin Heist Ransomware Address Dataset