justintv / Twitch-API

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

/search/streams seems broken #562

Closed DeezjaVu closed 8 years ago

DeezjaVu commented 8 years ago

https://api.twitch.tv/kraken/search/streams?query=Overwatch&offset=0&limit=100

Calling the above only returns 20 results, even though at this time there are supposedly 2000+ streams ("_total": 2045).

On top of that, it doesn't return the streams ordered by highest number of viewers. Has been like this for quite some time now. Was hoping someone would notice and fix, but guess I should know by now not to hold my breath when it comes to Twitch issues.

FugiTech commented 8 years ago

I've verified that we're returning less results than expected, however search endpoints are always ordered by relevance, not viewer count.

Perhaps you want https://api.twitch.tv/kraken/streams?game=Overwatch&limit=100 ?

DeezjaVu commented 8 years ago

search endpoints are always ordered by relevance, not viewer count.

That wasn't always the case. At some point it was changed. In the past it was always by viewer count. Or it may have been both relevance and viewer count.

I have an application (TMSViewer) developed about 3-4 years ago and its search function has always worked that way.

I'm not exactly sure when, but quite some time ago the search functionality started behaving poorly. The order was no longer by number of viewers and the limit parameter was ignored.

I wouldn't mind having additional parameters for sorting. In fact I'd welcome them as it would take the whole guessing game out of the picture.

Edit:

In the end, what I'm getting at is that '/streams?game=Overwatch' and '/search/streams?q=Overwatch' should return the same (top) results.

jixwanwang commented 8 years ago

This pagination limit bug has been fixed.

If you want streams ordered by viewer count, use /streams?game=Overwatch. Having those two endpoints return the same results would be redundant.

DeezjaVu commented 8 years ago

It shouldn't always return the same result, as one is a search the other isn't. However it should return a similar result when the given query is the same, for instance searching for a game title (e.g. overwatch). As I said earlier, that's how it actually used to be. A search for "overwatch" would return streams playing overwatch ordered by "game" + "number of viewers". It now returns results ordered by title (I think) and usually those are results with very few viewers.

On top of all that, performing any search on the twitch website always orders by number of viewers, regardless whether it's under "games" or "live channels".