#!/usr/bin/env perl use strict; use warnings; use LWP::UserAgent; use XML::RSS; my $input = join ' ', @ARGV; $input =~ /(who|what|where|when)\s*(is)?\s*(\w+)/i; my $type = $1; my $ism = $3; unless ($ism) { die "Must specify a term to search for.\n"; } if ($type =~ /who/i) { $type = 1; } elsif ($type =~ /what/i) { $type = 2; } elsif ($type =~ /where/i) { $type = 3; } elsif ($type =~ /when/i) { $type = 4; } else { die "Unknown query type! Should be: who, what, where, or when.\n"; } my $ua = LWP::UserAgent->new(); my $response = $ua->post('http://www.googlism.com/index.htm', { ism => $ism, type => $type }, ); unless($response->is_success) { die "$response->status_line\n"; } my $googlism = $response->content; my $output = XML::RSS->new(version => '0.91'); $output->channel( title => "Googlism for: $ism", link => "http://www.googlism.com/index.htm?ism=$ism&type=$type", language => 'en', description => 'Googlism.com will find out what Google.com thinks of you', ); while ($googlism =~ /($ism is.+)
/g) { $output->add_item(title => $1); } print $output->as_string; __END__ =pod =head1 NAME googlism -- Query www.googlism.com =head1 SYNOPSIS B =head1 DESCRIPTION Googlism was created as a fun tool to see what Google "thinks" of certain topics and people. Of course, the results are not really Google's opinion, they're yours, the web site owners of the world. Within the Google results are thousands of your thoughts and opinions about thousands of different topics and people, we simply search Google and let you know what website owners think about the name or topic you suggested. This script lets you query www.googlism.com and formats the results of your query in RSS 0.91 XML format. You can then postprocess this in various ways such as converting it to HTML to add to your web site. =head1 INSTALLATION Make the script executable. You will also need the B, and B packages from CPAN. =head1 SEE ALSO L =head1 AUTHOR Jaldhar H. Vyas Ejaldhar@braincells.comE =head1 LICENSE This code is free software under the Crowley Public License ("Do what thou wilt shall be the whole of the license") =head1 VERSION 1.0 -- Nov 10, 2002 =cut