on *:TEXT:!google*:#: {
if ($2- != $null) {
set %google.num 0
set %google.channel $chan
set %google.search $replace($2-,$chr(32),$chr(43))
sockclose google
sockopen google www.google.com 80
}
}
on *:sockopen:google: {
sockwrite -n $sockname GET $+(/search?sourceid=navclient&hl=en&ie=UTF-8&rls=GGLD,GGLD:2004-04,GGLD:en&q=,%google.search) HTTP/1.1
sockwrite -n $sockname Host: www.google.com
sockwrite -n $sockname Conenction: Keep-Alive
sockwrite -n $sockname $crlf
}
on *:sockread:google: {
sockread %google.tmp
if ($regex(%google.tmp,/<h2 class=.*><a href="(.*)" class=l>.*<b>/)) {
boris.cmd privmsg %google.channel 12,1G4o8o12g3l4e15 Search Result:3 $regml(1)
inc %google.num
}
if (%google.num == 3) {
sockclose google
unset %google*
}
}