mIRC Home    About    Download    Register    News    Help

Print Thread
uptime help #246927 14/07/14 10:59 AM
Joined: Aug 2013
Posts: 22
A
Achievements Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2013
Posts: 22
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)))) $+ .
  }
}

Re: uptime help [Re: Achievements] #246929 14/07/14 11:31 AM
Joined: Jan 2004
Posts: 1,351
L
Loki12583 Online
Hoopy frood
Online
Hoopy frood
L
Joined: Jan 2004
Posts: 1,351
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/>

Re: uptime help [Re: Loki12583] #246930 14/07/14 11:35 AM
Joined: Aug 2013
Posts: 22
A
Achievements Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2013
Posts: 22
wow so simple i feel like i had a huge brain Fart thanks man

Re: uptime help [Re: Achievements] #246935 14/07/14 03:32 PM
Joined: Mar 2014
Posts: 52
P
patrickplays Offline
Babel fish
Offline
Babel fish
P
Joined: Mar 2014
Posts: 52
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

Re: uptime help [Re: patrickplays] #246962 15/07/14 09:03 AM
Joined: Aug 2013
Posts: 22
A
Achievements Offline OP
Ameglian cow
OP Offline
Ameglian cow
A
Joined: Aug 2013
Posts: 22
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