A Python script to download all songs in a YouTube playlist as MP3 files using yt-dlp and ffmpeg.
- ✅ Download YouTube playlist as MP3
- ✅ Automatic audio extraction and conversion using
ffmpeg - ✅ Clean console output with real-time progress, download speed, and file size
- ✅ Playlist title and total video count shown
- ✅ Files saved into
downloads_mp3directory
pip install yt-dlpInstall ffmpeg:
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt install ffmpeg - Windows (with Chocolatey):
choco install ffmpeg
- Clone or download this repository.
- Open
youtube_mp3_downloader.pyand set your playlist URL:
PLAYLIST_URL = "https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID"- Run the script:
python3 main.py- MP3 files will be saved in the
downloads_mp3/folder.
main.py # Main script
downloads_mp3/ # Folder where MP3s are saved
📅 Fetching playlist info...
📂 Playlist: My Favorite Songs
🎮 Total videos: 12
[Downloading] -> 🎵 Song Title.webm 2.10MiB/4.00MiB (52.5%) 700.3 KB/s
[Downloaded] -> 🎵 Song Title.webm 3.88MB
...
✅ Done! MP3s saved in: downloads_mp3
- Only audio is downloaded (no video).
- Audio is converted to
.mp3usingffmpeg. - If you receive rate-limit or network errors, try a different network or VPN.
To change the audio quality:
'preferredquality': '192' # Can be set to '320' for highest qualityTo change the output folder:
OUTPUT_FOLDER = "my_music_folder"- ffmpeg not found → Make sure it's installed and in your system PATH.
- Playlist not fetching → Confirm it’s public and accessible.
- HTTP 403/400 errors → Retry later or use a VPN.
Feel free to fork, enhance or raise issues.
This project is licensed under the MIT License.
- Python 3
- Built using yt_dlp
- Terminal output styled manually
- Special thanks to ChatGPT-4o for assistance in scripting and logic design ✨