3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

Updated and reinstated google search

This commit is contained in:
Pragmatic Software 2011-12-06 16:46:39 +00:00
parent 314eabaf3e
commit 5e0ac12020
2 changed files with 1840 additions and 1045 deletions

File diff suppressed because it is too large Load Diff

43
modules/g.pl Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/perl -w -I /home/msmud/lib/lib/perl5/site_perl/5.10.0/
# Quick and dirty by :pragma
use Google::Search;
my ($nick, $arguments, $matches);
$matches = 3;
$nick = shift @ARGV;
if ($#ARGV < 0)
{
print "Usage: google [number of results] query\n";
die;
}
$arguments = join(" ", @ARGV);
if($arguments =~ m/^([0-9]+)/)
{
$matches = $1;
$arguments =~ s/^$1//;
}
my $search = Google::Search->Web(query => $arguments, referrer => 'http://blackshell.com');
print "$nick: ";
if(not $search->first) {
print $search->error->reason, "\n";
exit;
}
my $comma = "";
while( my $result = $search->next) {
print $comma, $result->titleNoFormatting, ": ", $result->uri;
$comma = " -- ";
last if --$matches <= 0;
}
print "\n";