mIRC Home    About    Download    Register    News    Help

Print Thread
A
Anubisxhades
Anubisxhades
A
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.

Last edited by Anubisxhades; 19/01/15 07:57 PM.
S
Sakana
Sakana
S
Code:
alias game {

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

}

Last edited by Sakana; 19/01/15 07:40 PM.
A
Anubisxhades
Anubisxhades
A
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?

Last edited by Anubisxhades; 19/01/15 07:49 PM.
S
Sakana
Sakana
S
As far as I can tell game info isn't available for offline channels smirk

A
Anubisxhades
Anubisxhades
A
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

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
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)


Last edited by FroggieDaFrog; 19/01/15 08:20 PM.
A
Anubisxhades
Anubisxhades
A
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!

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
No Problem. I was the one that wrote the JSON parser... And showed West how to use it.

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
^^ <3 FroggieDaFrog


Link Copied to Clipboard