All pastes #211541 Raw Edit

Untitled

public text v1 · immutable
#211541 ·published 2006-10-20 11:17 UTC
rendered paste body
on *:TEXT:!rsnews:#:{
  set %nick $nick
  set %chan $chan
  sockopen rsnews runescape.com 80
}
on *:sockopen:rsnews:{
  sockwrite -n $sockname GET /lang/en/aff/runescape/title.ws HTTP/1.1
  sockwrite -n $sockname Host: runescape.com $+ $crlf $+ $crlf
}
on *:sockread:rsnews:{
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %rsnews
    sockread %rsnews
    if (<dt><span class="newsdate">* iswm %rsnews || </span>*</dt> iswm %rsnews || <td style="text-align: justify; vertical-align: top;">*</td> iswm %rsnews) {
      var %stripped = $nohtml(%rsnews), %rsnewsdate = $gettok(%stripped,1,32), %rsnewstitle = $gettok(%stripped,2-,32), %rsnewstext = $gettok(%stripped,4-,32)
      msg %chan 14¤¤¤ 12RuneScape News 14¤¤¤2 %rsnewstitle 14¤2 %rsnewsdate 14¤
      sockclose $sockname
      halt
    }
  }
}
alias -l nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$chr(32),%x), %x = $remove(%x,&nbsp;)
  return %x
}