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
What is pytube?
Their official docs says,
pytube is a very serious, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos.
Installing pytube
Run the below command to install the pytube
package.
pip install pytube
Now, 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
pytube
visit their docs
Top comments (2)
wow.. how easy!
Python 🔥