Created
November 29, 2009 03:30
-
-
Save acotie/244777 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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