This project helps you convert your private Spotify playlists into MP3 files by searching for matching videos on YouTube and downloading the audio. It also includes a separate script to batch-edit MP3 metadata (album, artist, genre, etc.), perfect for organising your files for an MP3 player.
Why did I decide to do this project? I was manually downloading my Spotify playlists into an MP3 player, and it was getting too tedious 🤭. So I thought hmmm... maybe I can automate this, and it went well!
- SpotifyPlaylistReader.py → Script to extract songs from Spotify and download them as MP3s
- MP3TagEditor.py → Script to edit tags (album, artist, genre) of MP3 files
Make sure you have these installed:
- Python 3.9+
- Install Python packages:
pip install spotipy yt-dlp mutagenhttps://spotipy.readthedocs.io/en/2.22.1/#getting-started - Install FFmpeg (required by yt-dlp for MP3 conversion).
- For macOS (with Homebrew):
brew install ffmpeg - For Windows: Download FFmpeg from https://ffmpeg.org/download.html and add it to your system PATH.
What it does:
- Authenticates with your Spotify account
- Lists your playlists
- Let's you choose one playlist to download
- Fetches the song titles and artists
- Searches for each track on YouTube
- Downloads the best audio and converts it to MP3
You will need:
- A Spotify Developer App → ClientID & ClientSecret
- playlist-read-private scope
- Redirect URI set to: http://127.0.0.1:8888/callback
- You'll be prompted to log in to Spotify the first time.
Changes you MUST make to the code:
IMPORTANT❗️: Change
CLIENT_ID = 'id'andCLIENT_SECRET = 'secret'in the 🔓 authentication section, to match your Spotify Developer Credentials.
Change line 115 to match the path you want to download the songs to:
def download_as_mp3(youtube_url, song_name, output_folder='[ADD YOUR PATH HERE]'):
safe_filename = clean_filename(song_name)Example:
def download_as_mp3(youtube_url, song_name, output_folder='/MyWindowsPC/Downloads'):Open a terminal in the folder where you've cloned this repo and run python3 SpotifyPlaylistReader.py
What it does:
- Edits the metadata tags of all .mp3 files in a given folder
- Supports adding album name, artist, and genre
- Keeps things organised for MP3 players and music libraries
Open a terminal in the folder where you've cloned this repo and run python3 MP3TagEditor.py
You'll be prompted to:
- Enter a folder path with your MP3s
- Optionally enter album, artist, and genre names
- These scripts do not upload or re-host any copyrighted content.
- Always check YouTube’s and Spotify’s terms of use.
- This project is intended for personal use only.
Author: Giuliana E — frontend developer exploring Python