I recently wanted to run some migrations -playlists- from Apple Music to Spotify and vice versa(maybe). Yeah, I wanted my Suits playlist on both music platforms. Now, I know there are some web apps that do this, but I thought this would be a great learning experience.
The only thing I had to do was create a playlist on the target platform, with the same name, copy songs from the source platform and post them to the target platform, voila!.
This kind of thing requires some form of Authorization, OAuth. Luckily, I had written a post on OAuth 2.0 authorization code flow in node.js.
All I needed now was a list of API endpoints to achieve this:
- Get a list of track and artist names in a playlist from the source platform
- Search for tracks using name and artist for precision in the target platform
- Get a list of tracks URIs
- Create a playlist
- Add tracks to the playlist
Initially, the project was intended to be a migration tool, but I also enabled cross-platform sharing, whereby Spotify users can receive playlists from their Apple Music peers.
- React (Switched to Handlebars in production)
- Fastify - Node.js web framework
- OAuth 2.0 for Authorization