source: lab.git/misc/pagetitle.pl @ 6a2e5f1

Last change on this file since 6a2e5f1 was 89fbc5d, checked in by mitty <mitty@…>, 12 years ago

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@191 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100755
File size: 614 bytes
RevLine 
[788f3de]1#! /usr/bin/perl -w
2
3use strict;
4use warnings;
[89fbc5d]5use utf8;
[788f3de]6
7use LWP::Simple;
[89fbc5d]8binmode STDOUT => 'encoding(utf8)';
[788f3de]9
10my $file = shift @ARGV || exit;
11my $list;
12
13open $list, "<$file" || exit;
14
15my ($url, $content);
16while ($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.