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