mIRC Home    About    Download    Register    News    Help

Print Thread
twitch offline channel info check #250531 19/01/15 07:21 PM
Joined: Nov 2014
Posts: 10
A
Anubisxhades Offline OP
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.
Re: twitch offline channel info check [Re: Anubisxhades] #250532 19/01/15 07:37 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
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.
Re: twitch offline channel info check [Re: Sakana] #250533 19/01/15 07:47 PM
Joined: Nov 2014
Posts: 10
A
Anubisxhades Offline OP
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.
Re: twitch offline channel info check [Re: Anubisxhades] #250534 19/01/15 08:00 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
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

Re: twitch offline channel info check [Re: Sakana] #250535 19/01/15 08:03 PM
Joined: Nov 2014
Posts: 10
A
Anubisxhades Offline OP
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

Re: twitch offline channel info check [Re: Anubisxhades] #250536 19/01/15 08:15 PM
Joined: Apr 2010
Posts: 921
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 921
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
Re: twitch offline channel info check [Re: FroggieDaFrog] #250537 19/01/15 08:34 PM
Joined: Nov 2014
Posts: 10
A
Anubisxhades Offline OP
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!

Re: twitch offline channel info check [Re: Anubisxhades] #250538 19/01/15 08:37 PM
Joined: Apr 2010
Posts: 921
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 921
No Problem. I was the one that wrote the JSON parser... And showed West how to use it.


I am SReject
My Stuff
Re: twitch offline channel info check [Re: FroggieDaFrog] #250539 19/01/15 08:39 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
^^ <3 FroggieDaFrog