IRC bot help - uptime

If you’re looking for a mIRC bot based here it is:

on *:text:!uptime:#channel_here:{
  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=channel_name 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 #channel_here [Uptime] Streamname_here is online for $duration($calc($ctime - $ctime($regml(1)))) $+ .
  }
}