[src]
my $a = $b + $c;[/src]
#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use XML::Simple; my $key = shift @ARGV; $key =~ s/([^0-9A-Za-z_])/'%'.unpack('H2',$1)/ge; $key =~ s/ /+/g; my $url_prefix = "http://search.yahooapis.jp/WebSearchService/V1/" ."webSearch?appid=YahooDemo&query=$key&results=50"; my @aoks = map {$_->{Url}} @{get_results($url_prefix."&adult_ok=1")}; my @angs = map {$_->{Url}} @{get_results($url_prefix."&adult_ok=0")}; my %seen; @seen{@angs} = (); foreach my $item (@aoks) { print "$item\n" unless exists $seen{$item}; } sub get_results { my ($url) = @_; my $yahoo_response = get($url); my $xmlsimple = XML::Simple->new(); my $yahoo_xml = $xmlsimple->XMLin($yahoo_response); if (ref($yahoo_xml->{Result}) eq "ARRAY") { # found: many return $yahoo_xml->{Result}; } elsif (ref($yahoo_xml->{Result}) eq "HASH") { # found: 1 return [$yahoo_xml->{Result}]; } return []; # not found }
% hack_adult.pl eros http://www.shang-bu.com/jp/eros.htm http://eros.blog.shinobi.jp/Entry/3/ http://sketch-book.seesaa.net/category/11088-1.html % hack_adult.pl アイドル http://www.kumagaya.or.jp/~mamada/idol/idol.htm http://zxz.jugem.jp/ http://idol-yoshiwara.jp/ http://www.houmotsu.com/i/gazou.htm http://yapoo-bbs.net/bbs_ai/aidoru/
政略的思考法に秀でた人は、絶対に一つの目的だけのためにはことを行わ
ない。(p.76)