Google script for a Bot
on $*:TEXT:/^[~`!@^&.]g(oogle)? ./i:*: {
sockclose Google
set %Google# $iif($chan,$chan,$nick)
set %GoogleURL /search?q= $+ $regsubex($2-,/([ `@#$%^&+=\[\]{}\\|;'",<>\/?])/g,% $+ $base($asc(\t),10,16)) $+ &sourceid=navclient&btnI
sockopen Google www.google.com 80
}
on *:SOCKOPEN:Google: {
sockwrite -n Google GET %GoogleURL HTTP/1.1
sockwrite -n Google Host: www.google.com
sockwrite Google $crlf
}
on *:SOCKREAD:Google: {
sockread %Google
while ($sockbr) {
if (Location: isin %Google) {
msg %Google# $gettok(%Google,2,32)
unset %Google*
sockclose Google
return
}
sockread %Google
}
}
on $*:TEXT:/(https?\72\/\/www\.google\.com\/(search\?q=|url\?\S+?&url=)([^& ]+)\S+)/i:#: {
if ($len($regml(1)) >= 120) {
var %R = $regml(3)
msg $chan $iif($regex($regml(1),/^(https?\72\/\/www\.google\.com\/search)/),$regml(1) $+ ?q= $+ %R,$regsubex(%R,/%(..)/g,$chr($base(\t,16,10))))
}
}