Apple Music Kit Web API - User's Top Played Songs/Artists

Hello everyone! I am using the web version of the Apple Music Kit API, and similar to how Apple is able to produce a user's year in rewind playlist showing the most played artists/songs from a year, I am trying to replicate it for either a year or all time.

I have been searching the internet for days trying to figure it out, but I've been completely stuck. I am able to make the following HTTP request successfully.

GET https://api.music.apple.com/v1/me/library/songs/ which returns back the user's library of songs, but I haven't figured out how to get the play count. I have tried adding a query like such ?extend=playCount, but that doesn't work.

I can see here that the Swift Music Kit API is able to extend a play count property, but I haven't been able to figure it out for Web.

Ideally, I am looking for an endpoint that just shows a user's top artist/tracks similar to Spotify, however, whenever I try to use the heavy in rotation endpoint here, it always returns an empty array.

The way that I have described is the long-roundabout way where I'll have to fetch each individual song and sort by playCount.

But if anyone happens to know how I can do either of the options I've described, it will be truly appreciated ! I've seen other forums posts from years ago, but hopefully there's been a discovered way. Thank you!

  • Were you able to find a workaround yet? I'm running into the same issue. It's very frustrating to see a lack of consistency between the heavy rotation and the recently played endpoints.

Add a Comment

Replies

have you find anything related to this.? I'm running into the same issue.