Rev | Line | |
---|
[788f3de] | 1 | #! /usr/bin/perl -w |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
[89fbc5d] | 5 | use utf8; |
---|
[788f3de] | 6 | |
---|
| 7 | use LWP::Simple; |
---|
[89fbc5d] | 8 | binmode STDOUT => 'encoding(utf8)'; |
---|
[788f3de] | 9 | |
---|
| 10 | my $file = shift @ARGV || exit; |
---|
| 11 | my $list; |
---|
| 12 | |
---|
| 13 | open $list, "<$file" || exit; |
---|
| 14 | |
---|
| 15 | my ($url, $content); |
---|
| 16 | while ($url = <$list>) { |
---|
| 17 | sleep 1; |
---|
| 18 | chomp $url; |
---|
| 19 | print STDERR "getting $url : "; |
---|
| 20 | $content = get($url); |
---|
| 21 | if (! $content) { |
---|
| 22 | print STDERR "NG\n"; |
---|
| 23 | print "$url -> <NG>\n"; |
---|
| 24 | next; |
---|
| 25 | } |
---|
| 26 | print STDERR "OK\n"; |
---|
| 27 | if ($content =~ /<title>([^<]+)<\/title>/) { |
---|
| 28 | my $title = $1; |
---|
| 29 | print "$url -> $title\n"; |
---|
| 30 | } |
---|
| 31 | else { |
---|
| 32 | print "$url -> <?>\n"; |
---|
| 33 | } |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.