Skip to content
This repository was archived by the owner on May 19, 2026. It is now read-only.

Latest commit

 

History

History
100 lines (72 loc) · 2.98 KB

File metadata and controls

100 lines (72 loc) · 2.98 KB

Playlist Downloader

Download playlists from YouTube and Apple Music as MP3 files (or MP4 for YouTube video).

Features

Source What happens
YouTube playlist Downloaded directly via yt-dlp
Apple Music playlist Track metadata scraped from the public page; each track is then found on YouTube and downloaded

Requirements

Installation

git clone https://github.com/sujay1599/youtubePlaylistDL.git
cd youtubePlaylistDL
pip install -r requirements.txt

Usage

python playlist_downloader.py <URL> [options]

Download a YouTube playlist as MP3

python playlist_downloader.py "https://www.youtube.com/playlist?list=PLxxxxxx" -o ~/Music

Download a YouTube playlist as MP4 video

python playlist_downloader.py "https://www.youtube.com/playlist?list=PLxxxxxx" --video -o ~/Videos

Download an Apple Music playlist as MP3

python playlist_downloader.py "https://music.apple.com/us/playlist/my-playlist/pl.xxxxxx" -o ~/Music

The playlist must be public. The tool scrapes track names and artists from the Apple Music page, searches YouTube for each track, and downloads the audio.

All options

usage: playlist_downloader.py [-h] [-o DIR] [--video] url

positional arguments:
  url                   YouTube playlist URL or Apple Music playlist URL

options:
  -h, --help            show this help message and exit
  -o DIR, --output DIR  Output directory (default: downloads)
  --video               Download video (MP4) instead of audio — YouTube only

How Apple Music support works

  1. Fetches the public Apple Music playlist page.
  2. Extracts track titles and artist names from the page's embedded JSON data (JSON-LD and Apple's shoebox cache).
  3. For each track, runs a yt-dlp YouTube search (ytsearch1:artist - title official audio).
  4. Downloads the best audio match and converts it to MP3 via ffmpeg.

Note: Apple Music playlist pages are mostly server-rendered, so track data is typically available without JavaScript execution. However, private playlists or playlists behind a login wall cannot be scraped.

Output format

Files are saved as:

{output_dir}/
  001 - Artist - Track Title.mp3
  002 - Artist - Track Title.mp3
  ...

YouTube playlists use the playlist index as the prefix automatically.

Troubleshooting

Problem Solution
ffmpeg not found Install ffmpeg and ensure it is on your PATH
Apple Music: No tracks found Check the playlist is public; try again (page caching can vary)
YouTube: video unavailable yt-dlp skips unavailable videos automatically (--ignore-errors)
Rate limiting from YouTube Increase the time.sleep(1) delay in download_apple_music_playlist()