Are you feeling lucky?

brian_d_foy on 2003-01-25T01:32:04

Right now you are thinking "Do I have a web browser or don't I?".

You have to ask yourself one question---"Do I feel lucky?"

#!/usr/bin/perl
use strict;

use HTML::TreeBuilder; use HTML::FormatText; use LWP::Simple; use SOAP::Lite;

# get everything at http://api.google.com my $search = SOAP::Lite->service("File:GoogleSearch.wsdl");

my $results = $search->doGoogleSearch( $ENV{GOOGLE_KEY}, "@ARGV", 0, 1, "false", "", "false", "", "latin1", "latin1"); my $link = $results->{resultElements}[0]{URL}; my $data = get( $link ); my $tree = HTML::TreeBuilder->new_from_content( $data );

print HTML::FormatText->new(leftmargin => 0, rightmargin => 50 )->format( $tree );