1 # WWWSearch backend, with queries updating the is-db (optionally)
2 # Uses WWW::Search::Google and WWW::Search
3 # originally Google.pl, drastically altered.
8 use vars qw(@W3Search_engines $W3Search_regex);
9 @W3Search_engines = qw(AltaVista Dejanews Excite Gopher HotBot Infoseek
10 Lycos Magellan PLweb SFgate Simple Verity Google z);
11 $W3Search_regex = join '|', @W3Search_engines;
16 my ($where, $what, $type) = @_;
17 my $retval = "$where can't find \002$what\002";
20 my @matches = grep { lc($_) eq lc($where) ? $_ : undef } @W3Search_engines;
22 $where = shift @matches;
24 &::msg($::who, "i don't know how to check '$where'");
28 return unless &::loadPerlModule("WWW::Search");
31 $Search = new WWW::Search($where, agent_name => 'Mozilla/4.5');
34 if (!defined $Search) {
35 &::msg($::who, "$where is invalid search.");
39 my $Query = WWW::Search::escape_query($what);
40 $Search->native_query($Query,
44 # search_parse_debug => 2,
47 $Search->http_proxy($::param{'httpProxy'}) if (&::IsParam("httpProxy"));
48 #my $max = $Search->maximum_to_retrieve(10); # DOES NOT WORK.
50 my (@results, $count, $r);
51 $retval = "$where says \002$what\002 is at ";
52 while ($r = $Search->next_result()) {
54 $retval .= ' or ' if ($count > 0);
56 last if ++$count >= $maxshow;
59 &::performStrictReply($retval);