# Nome: google.pl # Autore: michele # GNU General Public License 2 # use LWP::UserAgent; IRC::register ("x-google", "1.2", "", ""); IRC::add_command_handler ("google", "prm"); IRC::print ("\n\00305:: \002X-Google\002 1.2 by michele loaded.. ::"); IRC::print ("\00308/google -c2 linux"); IRC::print ("\00308/google linux"); IRC::print ("\00308/google -c4 linux e irc\n\n"); # sub prm { my $tmp = @_[0]; $tmp =~ tr/ /+/; google ($tmp); } sub google { my $url = "http://www.google.com/search?q="; my $i = 0, my $c = 3; if ($_[0] =~ /.*?\-c(\w).*?/) { $c = $1; } $agent = new LWP::UserAgent; $request = new HTTP::Request ("GET", $url . $_[0]); $agent -> agent ("Netscape 4.78/U.S., 25-Jun-01; (c) 1995-2000"); $buf = $agent -> request ($request); $buf = $buf -> content; IRC::print ("\n"); while (($buf =~ m/
(.+?)\s\-\s/gi) && ($i < $c)) { IRC::print ("\00310\-\003 http:\/\/$1\n"); $i++; } IRC::print ("\n"); return (1); } ###