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)))) $+ .
}
}