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 youtube-dl.org. 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 ssyoutube.com/watch?v=videoID and then this will take you to savefrom.net 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 Savefrom.net. 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 savefrom.net 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 filename.py. 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.

Comments

  1. Hi, thanks for your blog, if you want to learn about programming languages like java, php, android app, embedded system etc. I think this training institute is the best one.
    best python training in coimbatore
    Android training in coimbatore
    Networking training in coimbatore

    ReplyDelete

Post a Comment

Popular posts from this blog

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

WinHex...Data Recovery and Forensics Tool