ppy / osu-api

Public API for accessing osu! related data.
320 stars 16 forks source link

Too much api requests to display beatmap background images #292

Closed Maxluli closed 4 years ago

Maxluli commented 4 years ago

I am making a small project where you have the users profile pages, and I want to show the beatmap background of the top_plays in the listing. In order to do this, I need the beatmapset_id to display the background image, however when using get_user_best I only get beatmap_id but I need beatmapset_id. So I need to make a new API request for each beatmap to get the beatmapset_id and get the background image wich can make a lots of avoidable calls.

Is there any way to get the beatmapset_id only with get_user_best or is it possible to add it?

omkelderman commented 4 years ago

cache the get_beatmap api results. The mapping from beatmapId to setId will probably never change, so if you store those values locally so you wont have to request it for a map ur application already has seen in the past

peppy commented 4 years ago

Caching the results is best, yep.