mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2016
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Feb 2016
Posts: 3
Hello,
I need a script that saves the stream time when a moderator types !highlight in chat. So i can easily edit the videos. I've tried this so far:

Originally Posted By: paper0rplastic
Using Froggie's JSON parser :

Code:
on *:text:!highlight:#: {
  highlight #
}

alias -l highlight {
  var %chan $1
  var %caster $mid(%chan,2)
  var %v highlight $+ $ticks
  JSONOpen -ud %v https://api.twitch.tv/kraken/streams/ $+ %caster
  var %id $json(%v,stream,_id)
  if (!%id) { msg %chan %caster is currently OFFLINE. | return }
  var %created $json(%v,stream,created_at)
  var %start $ctime($remove($replace(%created,T,$chr(32)),Z))
  var %uptime $duration($calc($gmt - %start))
  describe %chan + Highlight marker added at %uptime
  writeini highlights.ini %caster $ctime %uptime $+($chr(91),$asctime(m/d/yy),$chr(93))
}

on *:text:!display highlights:#: {
  var %caster $mid(#,2), %i 1 | while $ini(highlights.ini,%caster,%i) {
    var %m $v1 | var %r %r $readini highlights.ini %caster %m $chr(187) | inc %i
  }
  msg # $iif(%r,Highlight Markers: $left($v1,-2),There are no highlight markers.)
}


But for some reason its not working frown
Thanks for the help!

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
I wrote a script that does exactly this on my GitHub. Just replace %streamer with your Twitch channel. SReject provided the "TwitchTime" alias. It would be pretty simple to write a !display command to read the highlights.txt file.

Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Twitch had an API change requiring you to have Client-ID in the headers.

Code:
JSONOpen -ud %v https://api.twitch.tv/kraken/streams/ $+ %caster

needs to become
Code:
JSONOpen -uwd %v https://api.twitch.tv/kraken/streams/ $+ %caster
JSONUrlMethod %v GET
JSONUrlHeader %v Client-ID: [YOUR CLIENT ID]
JSONUrlGet %v


You can get your Client-ID for your application on the connections page on Twitch.

https://twitch.tv/settings/connections

In the Developer Applications your program should be there, if not, just sign it up. I also believe that SReject does have this in his mTwitch applications.

Joined: Feb 2016
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Feb 2016
Posts: 3
Thanks for the answers. I have problem with that "Client-ID" thingy. I was using mirc on local. How do i supposed to connect with twitch?

Joined: Jun 2015
Posts: 84
F
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
When you register your application just use http://localhost as your redirect URI, I can assure that it works as I'm doing that for my stuff.

Joined: Feb 2016
Posts: 3
T
Self-satisified door
OP Offline
Self-satisified door
T
Joined: Feb 2016
Posts: 3
I guess i get the id but script is still not working for me frown

http://pastebin.com/V57SWP9V

It says stream is offline when stream is online.


Link Copied to Clipboard