The Apple Music API provides a service to fetch a song via an identifier, as detailed in their documentation in this format https://api.music.apple.com/v1/catalog/us/songs/900032829
My goal is to pick songs at random, from an array of songs. My current blocker is obtaining the song IDs from the ordinary Apple Music links, which is in this format: https://music.apple.com/us/album/take-on-me-1985-12-mix-2015-remastered/1035047659?i=1035048414
What would be the best way convert normal Apple Music links (such as the one above) to a the unique song id? (For the purpose of this project, the territory could be set as us
)
Edit: there is a workaround to use the Spotify API, which is to look up a song's IRSC code, and then use the Apple Music's IRSC look up to find the song ID. (more detailed here)
The constraints of this project requires that I can only use the Apple Music API/MusicKit, which means the above workaround is not possible.