-
-
Save cherenkov/af4ec2c95b06bd09792b 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
$VAR1 = { | |
'td' => [ | |
'青眼の白龍', | |
'ブルーアイズ・ホワイト・ドラゴン' | |
] | |
}; |
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
#PERLのスクレイピングに関しての質問です。 Web::Scraperを使用.. - 人力検索はてな | |
#http://q.hatena.ne.jp/1334296420 | |
#参考 | |
#Web::Scraper 勝手に添削 - Bulknews::Subtech - subtech | |
#http://subtech.g.hatena.ne.jp/miyagawa/20070510/1178794595 | |
# | |
#Web::Scraper使ってみた - Unknown::Programming | |
#http://d.hatena.ne.jp/fbis/20070510/1178783909 | |
#!"C:\xampp\perl\bin\perl.exe" | |
print "Content-type: text/html; charset=UTF-8\n\n"; | |
use strict; | |
use warnings; | |
use Web::Scraper; | |
use Data::Dumper; | |
use Encode; | |
use URI; | |
my $url = URI->new('http://yugioh.wikia.com/wiki/Blue-Eyes_White_Dragon'); | |
my $res = scraper { | |
process '//td[preceding-sibling::th[contains(text(),"Japanese")]]/span', 'td[]' => sub { | |
my $text = $_->as_text or return; | |
$text = encode('utf-8', $text); | |
return $text; | |
}; | |
}->scrape($url); | |
print Dumper $res; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment