mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2014
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2014
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.

Last edited by Anubisxhades; 19/01/15 07:57 PM.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
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.
Joined: Nov 2014
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2014
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?

Last edited by Anubisxhades; 19/01/15 07:49 PM.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
As far as I can tell game info isn't available for offline channels smirk

Joined: Nov 2014
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2014
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

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

I am SReject
My Stuff
Joined: Nov 2014
Posts: 10
A
Pikka bird
OP Offline
Pikka bird
A
Joined: Nov 2014
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!

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


I am SReject
My Stuff
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
^^ <3 FroggieDaFrog


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard