Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 22, 2021 11:21 am GMT

How to download You Tube video using Python

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!

Watch now

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 YouTubeyoutube = 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!


Original Link: https://dev.to/dheerajprogrammer/how-to-download-you-tube-video-using-python-52mp

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To