Skip to content

Instantly share code, notes, and snippets.

@acotie
Created November 29, 2009 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acotie/244777 to your computer and use it in GitHub Desktop.
Save acotie/244777 to your computer and use it in GitHub Desktop.
#!/us/bin/perl
use strict;
use Web::Scraper;
use URI;
use Net::Twitter;
use YAML;
my $uri = URI->new("http://www.fujitv.co.jp/meza/uranai/");
my $scraper = scraper {
process '//td[@class="day" and @height < 100]', date => 'TEXT';
process '//table[contains(@background, "item/rank")]',
'ranking[]' => scraper {
process '.', 'rank' => [ '@background', sub { (/rank(\d+)/)[0] } ];
process "img", star => '@alt', image => '@src';
process "td.text" => text => 'TEXT';
process ".lucky", lucky => 'TEXT' };
};
my $result = $scraper->scrape($uri);
# ファイルチェック
if ( -e "mezaura.yaml" ){
unlink "mezaura.yaml"
}
# Dumpfileで出力してみる
YAML::DumpFile("mezaura.yaml",$result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment