Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET /search/streams endpoint doesn't return highest viewer count to lowest. #525

Closed
laere opened this issue Apr 1, 2016 · 3 comments
Closed

Comments

@laere
Copy link

laere commented Apr 1, 2016

Currently using the GET /search/streams endpoint for an application. I know that the GET /streams/ endpoint returns a limit of 100 streams, and returns the streams in order from highest to lowest current viewers. Was curious if the same could be done for the aforementioned endpoint in the title, /search/streams?

@tadachi
Copy link

tadachi commented Apr 6, 2016

https://api.twitch.tv/kraken/search/streams?q=starcraft

example:
streams.channel[0].title => "RERUN: StarCraft 2 - Snute vs. Fantasy (ZvT) - IEM Katowice 2015 - EU Qualifier"

               /* Get data from 
                  https://api.twitch.tv/kraken/search/streams?q=starcraft
                  via ajax json GET call
               */

               // Compare function for title to sort
               var compare = function(a, b) {
                    //a.title b.title
                    if (a.title < b.title) {
                        return 1;
                    } else if (a.title > a.title) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
                // Use compare function to sort by stream titles.
                var sorted_array = streams.channels.sort(compare)

Something along the lines of the above?

@laere
Copy link
Author

laere commented Apr 6, 2016

I didn't even consider something like that, I will give it a shot, thanks
for the advice!

On Tue, Apr 5, 2016 at 8:05 PM, TA notifications@github.com wrote:

https://api.twitch.tv/kraken/search/streams?q=starcraft

example:
streams.channel.title => "RERUN: StarCraft 2 - Snute vs. Fantasy (ZvT) -
IEM Katowice 2015 - EU Qualifier"

           /* Get data from ajax for
              https://api.twitch.tv/kraken/search/streams?q=starcraft
           */

           // Compare function for title to sort
           var compare = function(a, b) {
                //a.title b.title
                if (a.title < b.title) {
                    return 1;
                } else if (a.title > a.title) {
                    return -1;
                } else {
                    return 0;
                }
            }
            // Use compare function to sort by stream titles.
            var sorted_array = streams.channels.sort(compare)

Something along the lines of the above?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#525 (comment)

@DallasNChains
Copy link
Contributor

I would recommend asking these types of questions in the Twitch Developer Forums. Lots of helpful folks there. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants