Download entire playlists from YouTube or YouTube Music as high-quality MP3 (320 kbps) with automatic fallback and proper metadata.
This script uses yt-dlp and ffmpeg to extract the best available audio, convert it to MP3, embed cover art, and write metadata — with zero prompts or interruptions.
- MP3 only, converted at 320 kbps
- Works with YouTube and YouTube Music playlists
- Smart fallback: m4a → opus → bestaudio → best
- Embeds thumbnail as cover art
- Writes metadata (artist, album, track #, etc.)
- Saves progress using
.archive.txt - Organizes output by playlist and track index
- Supports cookies (cookies.txt or browser profile)
- Runs without any pauses or confirmations
pip install -U yt-dlpmacOS
brew install ffmpegpython3 d.py "PLAYLIST_URL"python3 d.py "https://music.youtube.com/playlist?list="Output structure:
downloads/
Playlist Name/
001 - Track Title [videoid].mp3
002 - Track Title [videoid].mp3
.archive.txt
python3 d.py "PLAYLIST_URL" -o mymusicpython3 d.py "PLAYLIST_URL" -c cookies.txtpython3 d.py "PLAYLIST_URL" -b chromeSupports: chrome, firefox, brave, edge, safari.
- Downloads audio only
- Converts to MP3 (320 kbps)
- Embeds playlist thumbnail as cover art
- Writes metadata via FFmpeg
- Skips files already downloaded (via
.archive.txt) - Uses YouTube’s
android_music→androidclient fallback
d.py
README.md
downloads/
...
Install ffmpeg and ensure it’s available in PATH.
Use:
-c cookies.txtor:
-b chromeyt-dlp automatically sanitizes filenames; rename manually if needed.
Free to use. Modify as needed.