Download Youtube Playlist And Videos Using Python

In this post I'll show you how to download Youtube Playlist and Youtube Videos. You might be knowing there are various software's and tricks which allow us to download youtube videos and save them, one which I found was youtube-dl, you can download source code of it from But I have written a Python(learn Python basics) script to download youtube videos at our convenience without relying on the third party software.

Let's Start
You might be knowing one trick, if we want to download youtube video without using software is to append "ss" before the youtube video link like and then this will take you to and from there you can download the video easily. Now to download one video is an easy task, but suppose you want to download a complete playlist of say >50 videos is too much hectic. As you always have to open each video of that playlist and then edit the URL and download it using So to ease this task of downloading the playlist of videos I have written a python script which will do it for you in the background. You just have to run this script and give it the URL of the playlist and then this script will download the whole playlist for you.
The trick behind this script is simple. The task which we perform manually to download videos using is automated in the script. The script does the same thing and follows the same steps which we do manually.

Note: I have used Selenium and BeautifulSoup to write this script. The thing which created problems for me was the web driver's issues on Mac Os. You might also face it so to resolve them try it yourself or comment on this post. Try not running this script on Mac Os.

Firstly there are some requirements which you have to make sure they are in you machine.
1. You must have Firefox version greater than 47. Download it from here(it's must because this issue wasted my time until i recognized it.)
2. Download Geckodriver. Extract it and copy it to /usr/local/bin/
3. Download BeautifulSoup form here or using below commands
    apt-get install python-bs4
    pip install beautifulsoup4
for reference go here
4. Download Selenium from here or using below command
    pip install -U selenium
for reference go here
5. Install Xvfb using command apt-get install xvfb
6. Install PyVirtualDisplay using command pip install pyvirtualdisplay

Now if you have installed all the above requirements and you have got a successfull results for each requirements then you are ready to run the script. Download the script from Github.
To run the script use command python Then it will ask you what to download, playlist or video, so press 1 or 2 and then just copy paste the url of the playlist or video whichever you want to download.

Hope you like this post. Please share it if you find it usefull.


Popular posts from this blog

"Remotely Bypass" Pattern Lock Of Android Device By Google

WinHex...Data Recovery and Forensics Tool

Crack Gmail and LinkedIn Account Using Brute Force Attack With Simple Python Script

Learn How To Decompile an APK File And Add Some Of Our Own Code To That APK. A Demo Of Decompiling Twitter APK To Get Twitter Username & Passwoed

Complete guide to learn Ethical Hacking