urgrue / Java-Twitch-Api-Wrapper

An asynchronous java wrapper for interaction with the Twitch API
MIT License
28 stars 23 forks source link

Get Current Viewer Count #15

Closed kman1459 closed 7 years ago

kman1459 commented 8 years ago

I don't if this should be under Pull request but can someone update the code for it to be possible to get the current viewer count. I ain't an expert programmer and don't know how to add code to GitHub projects...

Gikkman commented 8 years ago

You can already get the number of viewers from the API.

Twitch t = new Twitch();
//Get token and all that

twitch.streams().get(channel, new StreamResponseHandler() {

   @Override
   public void onSuccess(Stream stream) {

      //Make sure stream is not null here
      int viewers = stream.getViewers();    

   }
} ); 

Something like that.

kman1459 commented 8 years ago

Thanks Man!!! @Gikkman