All pastes #552378 Raw Edit

douche

public text v1 · immutable
·published 2007-06-09 08:08 UTC
rendered paste body
alias -l htmlfree return $regsubex($1-,/<.*>|&.*;/gU,)
on $*:text:/^[!@]urban/Si:#:{
  if (!$2) $iif($left($1,1) == @,msg $chan,notice $nick) You must Search for something $nick $+ !
  else {
    inc %sssch
    sockopen $+(urban.,%sssch) www.urbandictionary.com 80
    sockmark $+(urban.,%sssch) $+($iif($left($1,1) == @,msg $chan,notice $nick),@,$replace($2-,$chr(32),+,$chr(95),+,$chr(45),+))
  }
}
on *:sockopen:urban.*:{
  sockwrite -nt $sockname GET /define.php?term= $+ $gettok($sock($sockname).mark,2,64) HTTP/1.1
  sockwrite -nt $sockname Host: www.urbandictionary.com
  sockwrite -nt $sockname $crlf
}
on *:sockread:urban.*:{
  var %urbread
  sockread %urbread
  if (*isn't defined* iswm %urbread) {
    $gettok($sock($sockname).mark,1,64) No definition of $gettok($sock($sockname).mark,2,64) was found on urbandictionary.com
    sockclose $sockname
  }
  if (*<p>* iswm %urbread) {
    set %urbdef $replace($htmlfree(%urbread),</p,$null,<br,$null,</ br,$null)
  }
  if (*<p style="font-style:* iswm %urbread) {
    $gettok($sock($sockname).mark,1,64) Definition of $gettok($sock($sockname).mark,2,64) $+ : %urbdef
    $gettok($sock($sockname).mark,1,64) Example: $replace($gettok(%urbread,2,62),&quot;,",</p,$null,<br,$null,</ br,$null,/,$null)
    unset %urbdef
    sockclose $sockname
  }
}