Skip to content

mithulpranav24/Spotify-To-MP3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify to MP3

A collection of Python scripts to export Spotify playlists and download them as MP3s, along with various utilities for managing your local music library.

This project primarily relies on the spotdl library for downloading and the spotipy library for interacting with the Spotify Web API.

Important

Due to changes in the Spotify Web API, you must have a Spotify Premium account to use these scripts.

https://developer.spotify.com/blog/2026-02-06-update-on-developer-access-and-platform-security

Installation & Setup

1. Clone the Repository

git clone https://github.com/mithulpranav24/Spotify-To-MP3.git
cd Spotify-To-MP3

2. Set Up a Virtual Environment

It is not absolutely necessary, but it is recommended to use a virtual environment because the dependencies can get quite messy.

python -m venv venv

Activate it:

  • Windows: venv\Scripts\activate
  • macOS/Linux: source venv/bin/activate

3. Install Requirements

pip install -r requirements.txt

Ensure you have ffmpeg installed and on PATH. If you don't have ffmpeg then install it using:

spotdl --download-ffmpeg

4. Configure Spotify API Credentials

  1. Go to the Spotify Developer Dashboard and create a new app.
  2. In the app settings, set a Redirect URI (e.g., http://localhost:8888/callback).
  3. Create a .env file in the root directory of this project and add your credentials:
client_id='your_client_id'
client_secret='your_client_secret'
redirect_uri='your_redirect_uri'

Scripts Overview & Usage

Core Scripts:

  • get_spotify_playlists.py Connects to your Spotify account to fetch all your playlists and exports their Name, URL, and URI into a spotify_playlists.csv file.

  • Usage:

    python get_spotify_playlists.py
  • download_playlist.py Reads the spotify_playlists.csv file and prompts you to select which playlists you'd like to download. It then uses spotdl to download the selected playlists into a playlists/ directory.

  • Usage:

    python download_playlist.py

Utility Scripts (in misc/)

If your MP3 player has issues with displaying artist names correctly / lyrics / track numbers, try using one of these:

  • misc/artist.py Cleans up artist tags in audio files (MP3 and FLAC). It splits multiple artists separated by commas, semicolons, or slashes into a list format and sets the album artist to 'Various Artists'. Usage:

    python misc/artist.py <path_to_music_folder>
  • misc/check_unique.py Compares two Spotify playlists (A and B) and deletes any duplicate tracks found in Playlist B (i.e., songs that are also in Playlist A). Great for maintaining a unique playlist. Usage:

    python misc/check_unique.py <playlist_a_url> <playlist_b_url> --confirm
  • misc/count_m3u.py Counts the number of valid song entries in one or more .m3u playlist files. Usage:

    python misc/count_m3u.py <path_to_m3u_file_or_directory>
  • misc/metadata_modifier.py Scans a music folder and cleans up the artist names in the metadata by replacing slashes (/) with commas (, ) across various audio formats (MP3, FLAC, M4A, etc.). Usage:

    python misc/metadata_modifier.py <path_to_music_folder>
  • misc/remove_track_number.py Removes track number (TRCK) metadata from all MP3 files within a given directory. Useful for cleaning up a library if you prefer not to have track numbers. Usage:

    python misc/remove_track_number.py <path_to_music_folder>
  • misc/strip_lyrics.py Thoroughly removes lyrics from your music library. It deletes any external .lrc files and strips embedded lyric tags (like USLT/SYLT) directly from MP3 files. Usage:

    python misc/strip_lyrics.py <path_to_music_folder>

About

A collection of scripts that let you download spotify playlists as .mp3 files

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages