python YouTube video downloader

(yes its something we made in class couple months ago but mine didn’t work properly so i fixed it today)

I used python to download YouTube videos.

We made a code to download any video from YouTube using the URL

def download_video(url, save_path):
    try:
        yt = YouTube(url)
        streams = yt.streams.filter(progressive=True, file_extension='mp4')
        highest_res_stream = streams.get_highest_resolution()
        highest_res_stream.download(output_path=save_path)

this code gets the URL and downloads the video from YouTube

    if path:
        print('downloading')
        download_video(url, path)
        print('downloaded')
        

this code shows the steps like ‘downloading’ and ‘downloaded

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these