Skip to content

Instantly share code, notes, and snippets.

@vti
Created September 25, 2010 10:11
Show Gist options
  • Save vti/596704 to your computer and use it in GitHub Desktop.
Save vti/596704 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::Client;
my $client = Mojo::Client->new;
my $news = 'http://digg.com';
$client->max_redirects(3);
$client->get($news)->res->dom->find("h3 > a.story-title")->each(
sub {
my $a = shift;
print $a->text, "\n";
print Mojo::URL->new->host($news)->path($a->attrs->{href}), "\n\n";
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment