Skip to content

Instantly share code, notes, and snippets.

@vti
Created September 25, 2010 09:08
Show Gist options
  • Save vti/596643 to your computer and use it in GitHub Desktop.
Save vti/596643 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
my $query = join ' ' => @ARGV;
my $url = 'http://www.google.com/search';
use Mojo::Client;
use Mojo::URL;
my $client = Mojo::Client->new;
$client->get(Mojo::URL->new($url)->query(q => $query)->to_abs)
->success->dom->find('#ires > ol > h3 > a')->each(
sub {
my $a = shift;
print $a->text, "\n";
print $a->attrs->{href}, "\n\n";
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment