This project allows you to easily transfer playlists from Apple Music to Spotify. It uses Selenium to scrape song names from an Apple Music playlist and Spotipy (a Python client for the Spotify Web API) to search for these songs and create a playlist in Spotify.
- Automatically extracts song names from any public Apple Music playlist.
- Creates a new playlist on Spotify with the extracted songs.
- Skips songs that are unavailable on Spotify.
- User authentication via Spotify API.
Before running this project, ensure you have the following installed:
- Python 3.x
- Spotify Developer Account
- Apple Music Playlist URL
git clone https://github.com/hrishi-008/MelodyMigrate.git
cd MelodyMigrate
pip install -r requirements.txt
- Head over to Spotify Developer Dashboard and create a new app.
- Obtain the following credentials from your app:
- Client ID
- Client Secret
- Set up a
.env
file in the root of your project directory as follows:
SPOTIPY_CLIENT_ID=<Your Spotify Client ID>
SPOTIPY_CLIENT_SECRET=<Your Spotify Client Secret>
- Run the script to extract songs from an Apple Music playlist and create a new Spotify playlist:
python pipe.py
- Enter the Apple Music Playlist URL when prompted. The script will then:
- Scrape the song names using Selenium.
- Search Spotify for these songs using the Spotify API.
- Create a new private Spotify playlist and add the found songs to it.
-
Selenium Scraper:
- A Selenium script fetches the playlist webpage from Apple Music and extracts song names.
-
Spotipy API:
- The Spotipy library is used to interact with Spotify's API to search for each song and add it to the user's playlist.
- Selenium: To scrape song data from Apple Music.
- Spotipy: Python library to interact with the Spotify Web API.
- BeautifulSoup: (Optional) For additional web scraping functionalities.
- Requests: To handle HTTP requests.
You can install all dependencies using:
pip install selenium spotipy beautifulsoup4 requests
- Spotify API Documentation: Create Playlist
- Spotipy Documentation: Spotipy Docs
- Selenium Documentation: Selenium Docs
Feel free to submit issues or pull requests for improvements and new features!
- Thanks to Spotipy for simplifying the interaction with Spotify's API.
- Thanks to the Spotify Developer team for providing an excellent API!