mIRC Home    About    Download    Register    News    Help

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

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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/>

Loki12583 #246930 14/07/14 11:35 AM
Joined: Aug 2013
Posts: 22
A
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

Joined: Mar 2014
Posts: 52
P
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

Joined: Aug 2013
Posts: 22
A
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


Link Copied to Clipboard