mIRC Home    About    Download    Register    News    Help

Topic Options
#250531 - 19/01/15 07:21 PM twitch offline channel info check
Anubisxhades Offline
Pikka bird

Registered: 05/11/14
Posts: 10
I found this code http://pastebin.com/Y5jWXTZa#
which takes info from https://api.twitch.tv/kraken/streams/$2
I personally want to find a way to grab just the game info from https://api.twitch.tv/kraken/channels/$2
This way I can get the game info while the channel is offline.

The script is a bit over my head(mainly the json parsing) so I was hoping one of the many brilliant coders over here could help.

Also the original script is by ^WeSt.http://hawkee.com/snippet/16087/


Any help would be greatly appreciated. Thankyou.


Edited by Anubisxhades (19/01/15 07:57 PM)

Top
#250532 - 19/01/15 07:37 PM Re: twitch offline channel info check [Re: Anubisxhades]
Sakana Offline
Fjord artisan

Registered: 19/09/14
Posts: 259
Code:
alias game {

JSONOpen -du game https://api.twitch.tv/kraken/streams/ $+ $1-
echo -a Game: $json(game,stream,game)

}


Edited by Sakana (19/01/15 07:40 PM)

Top
#250533 - 19/01/15 07:47 PM Re: twitch offline channel info check [Re: Sakana]
Anubisxhades Offline
Pikka bird

Registered: 05/11/14
Posts: 10
The issue with taking the info from the streams part of the api rather than the channels part of the api is that the info is only available in 'streams' when the channel in question is online.

Do you think just changing it to:
Code:
alias game {

JSONOpen -du game https://api.twitch.tv/kraken/channels/ $+ $1-
echo -a Game: $json(game,stream,game)

}


would work?


Edited by Anubisxhades (19/01/15 07:49 PM)

Top
#250534 - 19/01/15 08:00 PM Re: twitch offline channel info check [Re: Anubisxhades]
Sakana Offline
Fjord artisan

Registered: 19/09/14
Posts: 259
As far as I can tell game info isn't available for offline channels smirk

Top
#250535 - 19/01/15 08:03 PM Re: twitch offline channel info check [Re: Sakana]
Anubisxhades Offline
Pikka bird

Registered: 05/11/14
Posts: 10
it is its under channels rather than streams though
heres a link to my channels api for instance, last game played was Binding of Issac https://api.twitch.tv/kraken/channels/anubisxhades

Top
#250536 - 19/01/15 08:15 PM Re: twitch offline channel info check [Re: Anubisxhades]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
The JSON parser West used comes from here:

http://hawkee.com/snippet/10194/


And here's how to do it:
Code:
alias twitch_stream_game {
  ;; Retrieve and parse the json
  JSONOpen -ud Twitch_Stream_Game https://api.twitch.tv/kraken/channels/ $+ $1

  ;; return the game
  return $json(Twitch_Stream_Game, game)
}


Code:
;; "The Binding of Issac"
//echo -a $twitch_stream_game(anubisxhades)



Edited by FroggieDaFrog (19/01/15 08:20 PM)
_________________________
I am SReject
My Stuff

Top
#250537 - 19/01/15 08:34 PM Re: twitch offline channel info check [Re: FroggieDaFrog]
Anubisxhades Offline
Pikka bird

Registered: 05/11/14
Posts: 10
That's it! Thank you sooo much mate, I've been spending months trying different ways to make this work(sockets have become my mortal enemy). Again, THANK YOU!

Top
#250538 - 19/01/15 08:37 PM Re: twitch offline channel info check [Re: Anubisxhades]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
No Problem. I was the one that wrote the JSON parser... And showed West how to use it.
_________________________
I am SReject
My Stuff

Top
#250539 - 19/01/15 08:39 PM Re: twitch offline channel info check [Re: FroggieDaFrog]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1511
Loc: Greece
^^ <3 FroggieDaFrog
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top