This Python script allows you to migrate playlists from Anghami to Spotify.
It utilizes the Spotify API, along with the BeautifulSoup and Spotipy libraries, to fetch the playlist information and copy it to your Spotify account.
Before running this script, ensure that you have the following installed on your machine:
- Python 3.x
- pip (Python package installer)
Additionally, make sure to install the required dependencies by running the following commands in your command prompt:
pip install beautifulsoup4
pip install spotipy
pip install tqdm
Follow the steps listed below to begin the playlist migration:
- Navigate to the playlist (or downloads and likes) you want to duplicate on Anghami's web player. Make sure that all the songs are loaded and viewable by scrolling to the bottom of the playlist.
- To save a web page as an HTML file, right-click on it and choose "Save As". Keep in mind the location where the HTML file was saved.
- Log in or register for a new account at Spotify for Developers - https://developer.spotify.com/dashboard/.
- Once logged in, go to the dashboard and create a new app. This app will allow you to access the Spotify API.
- After creating the app, copy the "Client ID" and "Client Secret" values. You may need to click on "Show Client Secret" to reveal it.
- Click on "Edit Settings" for your app and set the "Redirect URI" to http://127.0.0.1:8080. After authentication, Spotify will reroute users to this website.
- Go to your Spotify account and copy your account username. This will be used to identify your Spotify account during the migration process.
- Open the
config.ini
file and update the client ID, client secret and username values with the data you just acquired. - Run the script.
If you saved the HTML file in a different location than the script directory, you will need to update the html_file_path
variable in config.int
as well.
Also, do not forget to update the playlist_name
variable with the name of the playlist you want to migrate.
The BeautifulSoup library: https://www.crummy.com/software/BeautifulSoup/
The Spotipy library: https://spotipy.readthedocs.io/