mIRC Homepage

uptime help

Posted By: Achievements

uptime help - 14/07/14 10:59 AM

I tried to make a socket but it still not getting uptime from twitch I can't figure it out

Code:
on *:text:!uptime:#firestonetv:{
  uptime
}

alias uptime {
  sockopen tuptime api.justin.tv 80
}

on *:sockopen:tuptime:{
  if ($sockerr) { sockclose $sockname | halt }
  sockwrite -n $sockname GET /api/stream/list.xml?channel=firestonetv HTTP/1.1
  sockwrite -n $sockname Host: api.justin.tv $crlf $+ $crlf
}

on *:sockread:tuptime:{
  if ($sockerr) { sockclose $sockname }
  var %streamodata
  sockread %streamodata

  if ($regex(%streamodata,/<up_time>(.*)</up_time>/)) {
    msg #firestonetv [Uptime] Firestonetv is online for $duration($calc($ctime - $ctime($regml(1)))) $+ .
  }
}
Posted By: Loki12583

Re: uptime help - 14/07/14 11:31 AM

Well the socket looks fine, you're just getting an empty response and that's really beyond the scope here.

Code:
<?xml version="1.0" encoding="ascii"?>
<streams/>
Posted By: Achievements

Re: uptime help - 14/07/14 11:35 AM

wow so simple i feel like i had a huge brain Fart thanks man
Posted By: patrickplays

Re: uptime help - 14/07/14 03:32 PM

http://discuss.dev.twitch.tv/t/irc-bot-help-uptime/913/3

you will still have a problem if you are not in pst timezone. because justin.tv api will return the "streamstarttime" in pst timezone
Posted By: Achievements

Re: uptime help - 15/07/14 09:03 AM

Yeah Well I figure that out But for now that the only way I can see is working I don't know any other site that use API to show stream times
© 2022 mIRC Discussion Forums