Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

[API] Is there an efficient way to get a list of artists by the amount of liked songs?

[API] Is there an efficient way to get a list of artists by the amount of liked songs?

The challenge:

 

I would like to automate following artists for whom I have an variable threshold of tracks liked (in my liked songs). Or rather, I would like to search my liked songs and match artists that I've liked more than say 5 times and give those artists a follow.

Is there an efficient way to do this?

I guess the established way would be to just download the entire liked songs collection. But considering the amount of liked songs in my collection, I feel that in my case that would be severely suboptimal. (My liked songs do not even open through the web player. I think GraphQL hangs on it.)

Anyone have any suggestions?

Thanks!

Reply
1 Reply

The fastest way is to use the Get User's Saved Tracks endpoint, request 50 tracks at a time, and add 50 to the offset until the next variable is empty. After every request, you can extract the artis ids out of the data. After looping through your library, you can check if the ids occur 5 or more times, etc.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts

Staff
Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

Staff
ModeratorStaff / Moderator/ 3 years ago  in Social & Random

Type a product name