Open takoz53 opened 10 months ago
This isn't indexed at the database, so would be quite an involved change.
This isn't indexed at the database, so would be quite an involved change.
I do not understand why it is quite an involved change. This would just require to index it at the database (which will require computing power, not a lot of changes from the developer side), implementing a new key compatibility in the API and creating a query for the key to get the new data.
Am I missing something here?
duplicate of https://github.com/ppy/osu-web/issues/7374 (but this issue should probably be kept open instead, as it has more detail).
Problem
get_user
: Currentlyget_user
uses anid
or theusername
of an user to find their data and lastly yield back anUser
object. The issue here is that there is no reliable way to look up a player by rank. The only way to reliably look up for players by rank currently is by scraping it from the website by trying every single ID. This is probably not in interest for osu! and developers as it's a demerit for both sides (scraping sucks; Unnecessary traffic is bad for osu!). There is also one way to look up the top 10000 players by using the performance rankings and by filtering bypage
. There is sadly only 200 pages (thus 10 000), so we will never know about the other million of players. This was also requested for a longer time by multiple users, also visible in the forum. As an example, we can take this forum post from roughly a year ago.Proposal: Implementing a new key to look up for rank instead.
key
:{
id: string,
username: string,
rank: string,
}
Ifkey
is not given, ID lookup is prioritised as usual.By doing so, we can search for specific ranks. By calling e.g.
GET "https://osu.ppy.sh/api/v2/users/1/osu?key=rank"
, we will get mrekk hisUser
object (as of 03.12.2023).Problem
get_users
: Currently,get_users
uses multiple ids to find multiple users and yields multipleUser
objects back. The issue here is that there is no reliable way to look up multiple players by rank.Proposal: Extend get_users by an
optional key
key
:{
ids: string,
ranks: string
}
Ifkey
is not given,IDs
lookup is prioritised.By doing so, we can e.g. get all top players from 1 to 50 by calling
GET "https://osu.ppy.sh/api/v2/users?ranks%5B%5D=1,2,...,50"
. This will yield back anArray
ofUser
Objects, containing rank 1 to 50.