This project provides a Python script that automates the process of transferring playlists from Apple Music to Spotify. The script uses Selenium to scrape playlist data from Apple Music and the Spotipy library to create and populate a new playlist on Spotify.
- Headless Scraping: Utilizes Selenium in headless mode to efficiently scrape data from Apple Music.
- Playlist Transfer: Automatically creates a new Spotify playlist and adds the corresponding tracks.
- Error Handling: Notifies if a song cannot be found on Spotify.
- Modular Design: Easy to customize for additional features or different use cases.
- Python 3.8+
- Spotify Developer Account
- Apple Music Account
- Google Chrome and ChromeDriver
-
Clone the repository:
git clone https://github.com/Perry5596/Playlist-Converter.git cd apple-music-to-spotify
-
Set up a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up Spotify API credentials:
- Create a
.env
file in the project root and add your Spotify API credentials:
CLIENT_ID=your_spotify_client_id CLIENT_SECRET=your_spotify_client_secret
- Make sure to replace
your_spotify_client_id
andyour_spotify_client_secret
with your actual Spotify credentials.
- Create a
-
Download and set up ChromeDriver:
- Download ChromeDriver and ensure it matches your Chrome version.
- Update the path to the ChromeDriver executable in the script:
service = Service('path/to/your/chromedriver')
-
Edit the script:
- Replace the placeholder URL in the script with the Apple Music playlist URL you want to transfer:
url = 'https://music.apple.com/us/playlist/your_playlist_url_here'
-
Run the script:
python applemusic_to_spotify.py
-
Check your Spotify account:
- A new playlist should be created with the transferred songs.
- Raw Data Printing: The script prints out the raw extracted song and artist elements for debugging purposes.
- Error Messages: If a song is not found on Spotify, it is logged in the console.
If you'd like to contribute to this project, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize this script and improve its functionalities. Contributions are always welcome!