python program to download YouTube videos

YouTube is one of most powerful video content sharing website. Though there are a lots of website and tools are already available on the net to download YouTube videos but most of them either become outdated or not able to download whole playlist or ask some money.

Here in the Python program to download YouTube video we will achieve both our objective in less than 10 lines of code.

Python Script to download YouTube Playlist/videos

from __future__ import unicode_literals
import youtube_dl
import urllib
import shutil
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:[''])

How to run Python Script to Download YouTube Video

In order to download single YouTube Video or YouTube Video Playlist, You have to replace the video link from your address bar into line no. 7 and execute this program.

This Python YouTube downloader is dependent on youtube_dl python package. so in order to install this package in your python. run the following pip command

pip install youtube_dl

The same Python Program can be used to download videos from Facebook, Video, dailymotion and all the other video sharing website.

Python YouTube downloader is free to use and reuse so make changes as per your requirements and enjoy. If you have any query and suggestion, please submit via comments.

Print Friendly, PDF & Email

Related Posts

If you like CBSEToaday and would like to contribute, you can also write an article using submit article or mail your article to See your article appearing on the main page and help other students/teachers.