This content originally appeared on DEV Community and was authored by Dheeraj-programmer
Intro
In this post you know about how to download youtube vidoes very easily in only in only four lines of code!!
Save your time watch video!
Requirments
pip install pytube
Pytube: Pytube is a very serious, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos. If You want to know more about pytube take a look of documentaion
Let's code
First import youtube from pytube
from pytube import YouTube
Make a variable and paste the web url link of any video don't use the link which you get click on share button.
youtube = YouTube('https://www.youtube.com/watch?v=2Wb2313oHxc')
video = youtube.streams.first()
The streams function is fetch video description, title, thumbnail and all these things but only for download video use first() with streams
Then finally use the download function to download the video and give the directory path where you want to download video
video.download('C:/Users/96650/Desktop/')
The all code look like this!
from pytube import YouTube
youtube = YouTube('https://www.youtube.com/watch?v=2Wb2313oHxc')
video = youtube.streams.first()
video.download('C:/Users/96650/Desktop/')
If you still reading here please like my content
Happy coding!
This content originally appeared on DEV Community and was authored by Dheeraj-programmer
Dheeraj-programmer | Sciencx (2021-12-22T11:21:02+00:00) How to download You Tube video using Python. Retrieved from https://www.scien.cx/2021/12/22/how-to-download-you-tube-video-using-python/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.