Effortlessly Download YouTube Playlists in Bulk with Python: 3 Effective Methods

Rahul BhattRahul Bhatt
2 min read

Photo by Szabo Viktor on Unsplash

Have you guys ever wanted to download your entire YouTube playlist?

Finding yourself frustrated with those YouTube downloaders and downloading your videos one by one is annoying.

Well, if you have been following my articles, you know that I really love Python and today we’ll be writing a script to download the entire playlist in mp4 and audio format.

You can download videos or the entire playlist in mp4 or mp3 format with the methods mentioned below.

First thing first pre-requirements:

  1. Anaconda/MiniConda (Python version 3.7)

  2. Any text editor of your choice

1. Download YouTube playlist in mp4 format

Step 1: Install the pytube package using the following command.

Download pytube library using this command

Step 2: Write this script or check out my code in my Github repository mentioned below.

Basic code setting up the directory and your yt playlist link

Step 3: Loop through the entire playlist and download them one by one.

filter() method is the most important method, letting you download your video with several options like progressive or adaptive.

The progressive option gives you the ability to download the audio and video file in a single unit.

The adaptive option gives you the ability to split the audio and video file thus allowing you to download only audio or only video.

Download all the videos from your yt playlist in mp4

2. Download the YouTube playlist in mp4 but the only audio format

Download all the videos from your yt playlist in mp4 in audio format

3. Download the YouTube playlist in mp3

Step 1: Install ffmpy to convert the mp4 to mp3, this is important since pytube doesn’t let you download the audio file mp3.

Install ffmpy for converting mp4 into mp3

Step 2: Script to download the YouTube playlist in mp3 in your desired folder.

For truly mp3 format you can use ffmpy

Check out the code in my Github

PythonScripts/ytPlaylistDownload.py at main · rahulbhatt1899/PythonScripts
*All my python scripts mentioned on my medium blog @rahulbhatt1899 — PythonScripts/ytPlaylistDownload.py at main ·…*github.com

Please do check out the references without which this article wasn’t possible:

References:

pytube — pytube 11.0.0 documentation
*This part of the documentation begins with some background information about the project, then focuses on step-by-step…*pytube.io

ffmpy — ffmpy 0.2.2 documentation
*ffmpy resembles the command line approach FFmpeg uses. It can read from an arbitrary number of input “files” (regular…*ffmpy.readthedocs.io

0
Subscribe to my newsletter

Read articles from Rahul Bhatt directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rahul Bhatt
Rahul Bhatt