Created
April 6, 2009 04:48
-
-
Save mattn/90638 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use WWW::Mechanize; | |
use WWW::Mechanize::AutoPager; | |
use Web::Scraper; | |
use YAML::Syck; | |
my $mech = WWW::Mechanize->new(timeout => 10); | |
$mech->add_header('Accept-Encoding', 'identity'); | |
$mech->autopager->load_siteinfo(); | |
my $greeting = scraper { process 'div.storycontent p', text => 'TEXT'; }; | |
my $u = 'http://alpha.mixi.co.jp/blog/?author=3'; | |
while($u) { | |
my $res = $greeting->scrape( $mech->get($u)->decoded_content ); | |
print Dump $res; | |
last if ( $@ or !defined($mech->next_link) ); | |
$u = $mech->next_link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment