Hey guys, in this short post lets see how we can download youtube videos using Python.
To make this possible, we use a package called pytube
Their official docs says,
pytube is a very serious, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.
Run the below command to install the
pip install pytube
pytube is successfully installed on your system.
To download a video, simply copy the URL of that video and run the below code
from pytube import YouTube url = "http://youtube.com/watch?v=9bZkp7q19f0" YouTube(url).streams.first().download()
Thats it folks :)
To learn more about
pytubevisit their docs