* check for and use of old blootbot.(users|chan) files
+* Retired the old broken W3Search module in favour of a working Google search
+
+* Removed +W3Search in infobot.chan, added +Google (don't forget to update your
+configs)
+
1.5.3
=====
If we missed you from this list, drop us a line and we will be sure to give
credit where it is due.
+#People
+-------
+
+Brett Cave (Google search)
#perl@freenode.net
------------------
---------------------
quin - many thanks for ctcp version bug help
+
# vim:ts=4:sw=4:expandtab:tw=80
+Dict
+Exchange
+Factoids
+ +Google
+HTTPDtype
+Kernel
+Math
+Topic
+Units
+UserInfo
- +W3Search
+Weather
+Zippy
addressCharacter ~
return;
}
- # google searching. Simon++
- my $w3search_regex = 'google';
+ # google searching -- thanks Brett Cave
if ( $message =~
- /^(?:search\s+)?($w3search_regex)\s+(?:for\s+)?['"]?(.*?)["']?\s*\?*$/i
+ /^(\s+)?google\s+['"]?(.*?)["']?\s*\?*$/i
)
{
- return unless ( &IsChanConfOrWarn('W3Search') );
+ return unless ( &IsChanConfOrWarn('Google') );
- &Forker( 'W3Search', sub { &W3Search::W3Search( $1, $2 ); } );
+ &Forker( 'Google', sub { &Google::GoogleSearch( $2 ); } );
- $cmdstats{'W3Search'}++;
+ $cmdstats{'Google'}++;
return;
}
--- /dev/null
+# W3Search drastically altered back to GoogleSearch as Search::Google
+# was deprecated and requires a key that google no longer provides.
+# This new module uses REST::Google::Search
+# Modified by db <db@cave.za.net> 12-01-2008.
+
+package Google;
+
+use strict;
+
+my $maxshow = 5;
+
+sub GoogleSearch {
+ my ( $what, $type ) = @_;
+ my $where = "Google";
+ my $retval = "$where can't find \002$what\002";
+ my $Search;
+
+ return unless &::loadPerlModule("REST::Google::Search");
+
+ REST::Google::Search->http_referer('http://infobot.sourceforge.net/');
+ $Search = REST::Google::Search->new( q => $what );
+
+ if ( !defined $Search ) {
+ &::msg( $::who, "$where is invalid search." );
+ return;
+ }
+
+ if ( $Search->responseStatus != 200 ) {
+ &::msg( $::who, "http error returned." );
+ return;
+ }
+
+ my $data = $Search->responseData;
+ my $cursor = $data->cursor;
+ my @results = $data->results;
+
+ my $count;
+ $retval = "$where says \002$what\002 is at ";
+ foreach my $r (@results) {
+ my $url = $r->url;
+ $retval .= ' or ' if ( $count > 0 );
+ $retval .= $url;
+ last if ++$count >= $maxshow;
+ }
+
+ &::performStrictReply($retval);
+}
+
+1;
+
+# vim:ts=4:sw=4:expandtab:tw=80
+++ /dev/null
-# WWWSearch backend, with queries updating the is-db (optionally)
-# Uses WWW::Search::Google and WWW::Search
-# originally Google.pl, drastically altered.
-
-package W3Search;
-
-use strict;
-use vars qw(@W3Search_engines $W3Search_regex);
-
-@W3Search_engines = qw(AltaVista Dejanews Excite Gopher HotBot Infoseek
- Lycos Magellan PLweb SFgate Simple Verity Google z);
-$W3Search_regex = join '|', @W3Search_engines;
-
-my $maxshow = 5;
-
-sub W3Search {
- my ( $where, $what, $type ) = @_;
- my $retval = "$where can't find \002$what\002";
- my $Search;
-
- my @matches = grep { lc($_) eq lc($where) ? $_ : undef } @W3Search_engines;
- if (@matches) {
- $where = shift @matches;
- }
- else {
- &::msg( $::who, "i don't know how to check '$where'" );
- return;
- }
-
- return unless &::loadPerlModule("WWW::Search");
-
- eval { $Search = new WWW::Search( $where, agent_name => 'Mozilla/4.5' ); };
-
- if ( !defined $Search ) {
- &::msg( $::who, "$where is invalid search." );
- return;
- }
-
- my $Query = WWW::Search::escape_query($what);
- $Search->native_query(
- $Query,
- {
- num => 10,
-
- # search_debug => 2,
- # search_parse_debug => 2,
- }
- );
- $Search->http_proxy( $::param{'httpProxy'} ) if ( &::IsParam('httpProxy') );
-
- #my $max = $Search->maximum_to_retrieve(10); # DOES NOT WORK.
-
- my ( @results, $count, $r );
- $retval = "$where says \002$what\002 is at ";
- while ( $r = $Search->next_result() ) {
- my $url = $r->url();
- $retval .= ' or ' if ( $count > 0 );
- $retval .= $url;
- last if ++$count >= $maxshow;
- }
-
- &::performStrictReply($retval);
-}
-
-1;
-
-# vim:ts=4:sw=4:expandtab:tw=80