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