speedruncomorg / api

REST API Documentation for speedrun.com
346 stars 36 forks source link

Leaderboard doesn't give ALL runs #135

Open VisionElf opened 3 years ago

VisionElf commented 3 years ago

Hello, i'm using the API to get all leaderboard runs using this link:

https://www.speedrun.com/api/v1/leaderboards/m1zjpl36/level/y9m04g5w/q25m69yd

This is supposed to retrieve Phasmophobia - Willow Street House - Solo Category

However, the current WR is this run: yvo1egoz But it's nowhere to be found in the response.

The run was submitted 1 week ago so I don't think that's a delay problem.

I'm not sure why it doesnt work, I've tried other levels and there is the same issue in other levels but not all of them. I've tried using the var-xxxx query parameter but it doesn't fix the issue.

Any idea?

exodustx0 commented 3 years ago

What you're looking for: https://www.speedrun.com/api/v1/leaderboards/m1zjpl36/level/y9m04g5w/q25m69yd?var-ylpezr68=jq6rmy3q&var-ylq66mz8=21g6n2mq&var-yn2jx3d8=5le538ml

Without supplying var-__=__ filters, this endpoint will return runs ordered without regard for sub-categories. The WR you got in your request is of the Any% sub-category; you must add var-yn2jx3d8=5le538ml to only get runs from the 100% sub-category. Obviously, if you only add that one, you'll get 0.26 runs ahead of this 0.3 one, but it's the same situation there.

(For manual API requests, getting the right sub-category variable/value IDs for a run is easier if you do the request without sub-category filters but embedding variables; that embeds only those sub-categories that are relevant to the leaderboard you're requesting.)

As for why yvo1egoz isn't included in the full list of runs ignoring sub-categories... I haven't the foggiest. Maybe someone else can provide info on that. There's plenty of other weird stuff going on in the total leaderboard request that I don't understand (two runs with place 0 that aren't on the bottom of the list; the two runs that are below them continue the place incrementing ignoring the 0 place runs, but have times that should place them in front of other runs that don't have 0 place).

VisionElf commented 3 years ago

What I don't understand is that, one leaderboard gets me around 150 runs (which includes all sub-categories run) while this one only gets 19. I don't provide any query param filter for either of these 2 requests.

Thanks for the tip.

exodustx0 commented 3 years ago

What I don't understand is that, one leaderboard gets me around 150 runs (which includes all sub-categories run) while this one only gets 19.

I'm not sure what you're referring to here; the Willow Street House: Solo category only has 20 runs, so 19 is right, excluding the mystery of the run you were asking about. What returns ~150 runs?

VisionElf commented 3 years ago

Ah so it's just one run, yea I didn't count the actual total run counts, my bad ahah. I assumed because 1 run was missing, there would be more runs missing as well.

Well for instance Tanglewood Solo leaderboard Duo returns 157 runs, which includes all Any%, 100% and 200%. (for all server versions) and doesn't seem to lack any run (I didn't check everything though)

I also have this issue with other leaderboards like Ridgeview Solo (returns 44 runs), Asylum Solo (28 runs), Bleasdale Solo (33 runs) Some of them are missing more than 1 run.

exodustx0 commented 3 years ago

I'm aware that it'd take a bit of research, but are you able to discern any commonalities between runs that are not included in the leaderboard request? Seeing as there are quite a bunch that don't get included (I count 38 runs in the Asylum Solo category, wow).

One thing that I can imagine is that they're all recent-ish, seeing as the run you were initially targeting seemed to be the most recent run.

VisionElf commented 3 years ago

I've checked and some missing runs are from 30 august where I can see runs from 4 or 5 sept so I don't think time is the issue. I'll use the query parameters for now, it seem to be working perfectly, thanks again!