line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Duadua::Parser::Bot::HatenaBot; |
2
|
6
|
|
|
6
|
|
37
|
use strict; |
|
6
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
173
|
|
3
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
164
|
|
4
|
6
|
|
|
6
|
|
32
|
use Duadua::Util; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
3576
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub try { |
7
|
90
|
|
|
90
|
1
|
201
|
my ($class, $d) = @_; |
8
|
|
|
|
|
|
|
|
9
|
90
|
100
|
|
|
|
212
|
return if index($d->ua, 'Hatena') == -1; |
10
|
|
|
|
|
|
|
|
11
|
13
|
100
|
100
|
|
|
25
|
if ( index($d->ua, 'Hatena Antenna/') > -1 ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
12
|
2
|
|
|
|
|
8
|
my $h = { |
13
|
|
|
|
|
|
|
name => 'Hatena Antenna', |
14
|
|
|
|
|
|
|
is_bot => 1, |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
2
|
100
|
|
|
|
6
|
if ($d->opt_version) { |
18
|
1
|
|
|
|
|
4
|
my ($version) = ($d->ua =~ m!^Hatena Antenna/([\d.]+)!); |
19
|
1
|
50
|
|
|
|
4
|
$h->{version} = $version if $version; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
7
|
return $h; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Hatena Pagetitle Agent/') > -1 ) { |
25
|
2
|
|
|
|
|
7
|
my $h = { |
26
|
|
|
|
|
|
|
name => 'Hatena Pagetitle Agent', |
27
|
|
|
|
|
|
|
is_bot => 1, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
2
|
100
|
|
|
|
6
|
if ($d->opt_version) { |
31
|
1
|
|
|
|
|
3
|
my ($version) = ($d->ua =~ m!^Hatena Pagetitle Agent/([\d.]+)!); |
32
|
1
|
50
|
|
|
|
7
|
$h->{version} = $version if $version; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
6
|
return $h; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Hatena Star UserAgent/') > -1 ) { |
38
|
2
|
|
|
|
|
6
|
my $h = { |
39
|
|
|
|
|
|
|
name => 'Hatena Star UserAgent', |
40
|
|
|
|
|
|
|
is_bot => 1, |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
2
|
100
|
|
|
|
6
|
if ($d->opt_version) { |
44
|
1
|
|
|
|
|
4
|
my ($version) = ($d->ua =~ m!^Hatena Star UserAgent/([\d.]+)!); |
45
|
1
|
50
|
|
|
|
6
|
$h->{version} = $version if $version; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
8
|
return $h; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Hatena-Favicon/') > -1 ) { |
51
|
2
|
|
|
|
|
7
|
my $h = { |
52
|
|
|
|
|
|
|
name => 'Hatena-Favicon', |
53
|
|
|
|
|
|
|
is_bot => 1, |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
|
56
|
2
|
100
|
|
|
|
6
|
if ($d->opt_version) { |
57
|
1
|
|
|
|
|
4
|
my ($version) = ($d->ua =~ m!^Hatena-Favicon/([\d.]+)!); |
58
|
1
|
50
|
|
|
|
5
|
$h->{version} = $version if $version; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
9
|
return $h; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif ( index($d->ua, 'Hatena::') > -1 && $d->ua =~ m!^(Hatena::[a-zA-Z:]+)/!) { |
64
|
2
|
|
|
|
|
10
|
my $h = { |
65
|
|
|
|
|
|
|
name => $1, |
66
|
|
|
|
|
|
|
is_bot => 1, |
67
|
|
|
|
|
|
|
}; |
68
|
|
|
|
|
|
|
|
69
|
2
|
100
|
|
|
|
5
|
if ($d->opt_version) { |
70
|
1
|
|
|
|
|
4
|
my ($version) = ($d->ua =~ m!^Hatena::[a-zA-Z:]+/([\d.]+)!); |
71
|
1
|
50
|
|
|
|
6
|
$h->{version} = $version if $version; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
7
|
return $h; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
elsif ( index($d->ua, 'HatenaBookmark/') > -1 ) { |
77
|
3
|
|
|
|
|
9
|
my $h = { |
78
|
|
|
|
|
|
|
name => "HatenaBookmark", |
79
|
|
|
|
|
|
|
is_bot => 1, |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
3
|
100
|
|
|
|
8
|
if ($d->opt_version) { |
83
|
1
|
|
|
|
|
3
|
my ($version) = ($d->ua =~ m!^HatenaBookmark/([\d.]+)!); |
84
|
1
|
50
|
|
|
|
5
|
$h->{version} = $version if $version; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
3
|
|
|
|
|
11
|
return Duadua::Util->set_os($d, $h); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |