justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Search API with limit parameter returns inconsistent results #513

Open burakkurkcu opened 8 years ago

burakkurkcu commented 8 years ago

Hi, there is a problem with search api, that result count cannot be limited properly by limit parameter. Below there are some results proving that.

https://api.twitch.tv/kraken/search/streams?q=starcraft&limit=6 returns 6 streams. https://api.twitch.tv/kraken/search/streams?q=starcraft&limit=7 returns 6 streams. https://api.twitch.tv/kraken/search/streams?q=starcraft&limit=12 returns 9 streams. https://api.twitch.tv/kraken/search/streams?q=starcraft&limit=16 returns 14 streams. https://api.twitch.tv/kraken/search/streams?q=starcraft&limit=18 returns 16 streams.

Note: With _total parameter response shows there are ~100 streams as I am searching now, which is much more than I need to limit. I've also tried many other search requests with/without headers (Accept & Client-ID), with different limit values, by with/without offset parameter but there is no luck so far.

DallasNChains commented 8 years ago

Is this still happening?

Thijsiez commented 7 years ago

I'm having the exact same problem. I just moved to v5 and I only now noticed this, not sure if it was in v3 as well...

_total tells me there are around 150 results, with limit and without offset sometimes returns the correct amount of streams, but most of the times (with and without offset) it's less than my specified limit, while my offset is not even close to _total

Small note, _total also seems to fluctuate a lot, sometimes dipping down by 10, going from ~150 to ~140 and back up to 150 in 3 separate requests, each executed immediately after the one before finishes

I would gladly provide you with more details :)