This project allows you to download and tag songs, albums, or playlists from Spotify as MP3 files. The script fetches metadata from Spotify, searches for the corresponding songs on YouTube Music, and downloads them using yt-dlp. Additionally, it tags the MP3 files with the appropriate metadata and album cover art.
- Download tracks from Spotify playlists, albums, or individual tracks.
- Search and download corresponding tracks from YouTube Music.
- Tag downloaded MP3 files with metadata (title, artist, album, year, track number) and album cover art.
- Concurrent downloads to save time.
- Python 3.7 or higher
requestsyt-dlpmutagenodesli
-
Clone this repository:
git clone https://github.com/josuloo99/Spotify2MP3.git cd Spotify2MP3 -
Install the required packages:
pip install requests yt-dlp mutagen odesli
-
Set your Spotify and YouTube API credentials:
SPOTIFY_CLIENT_ID = 'your_spotify_client_id' SPOTIFY_CLIENT_SECRET = 'your_spotify_client_secret' YOUTUBE_API_KEY = 'your_youtube_api_key'
-
Run the script with the link to a Spotify track, album, or playlist you want to download:
python main.py <link>
- Spotify Metadata Fetching: The script fetches metadata for the specified track, album, or playlist using the Spotify API.
- YouTube Music Search: It searches for the corresponding tracks on YouTube Music using the Odesli (Songlink) API and the YouTube Data API.
- Download and Tagging: The script downloads the tracks as MP3 files using
yt-dlpand tags them with the fetched metadata and album cover art.
- Output Folder: By default, the downloaded files are saved in the
Downloadsfolder. You can change this by updating theOUTPUT_FOLDERvariable. - Max Workers: Adjust the
MAX_WORKERSvariable to control the number of concurrent downloads.
- Ensure your API keys and client secrets are correct.
- Make sure you have a stable internet connection.
- Check for any errors in the console output for specific issues.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.