Skip to content

Instantly share code, notes, and snippets.

@aerith
Created July 22, 2009 03:26
Show Gist options
  • Save aerith/151774 to your computer and use it in GitHub Desktop.
Save aerith/151774 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl --
use strict;
use warnings;
use Web::Scraper;
use HTML::TreeBuilder::LibXML;
sub get_data {
my $endpoint = URI->new(qq!http://ladio.net/list/!);
my $scraper = scraper {
process 'div.box-inner li.channel li.title > a', 'result[]' => sub {
my $node = shift;
my $page = URI->new($node->attr('href'));
scraper(
sub {
process 'div.box-inner div.leftBox table:first-child tr td', 'data[]' => 'TEXT';
result qw/data/;
}
)->scrape($page);
};
};
$scraper->scrape($endpoint);
}
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment