line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::GoKGS::Scraper::TournLinks; |
2
|
9
|
|
|
9
|
|
50
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
318
|
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
249
|
|
4
|
9
|
|
|
9
|
|
55
|
use Exporter qw/import/; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
322
|
|
5
|
9
|
|
|
9
|
|
48
|
use WWW::GoKGS::Scraper::Declare; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
67
|
|
6
|
9
|
|
|
9
|
|
553
|
use WWW::GoKGS::Scraper::Filters qw/datetime/; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
5224
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw( __build_tourn_links ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub __build_tourn_links { |
11
|
3
|
|
|
3
|
|
3
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my @start_time = ( |
14
|
|
|
|
|
|
|
sub { |
15
|
0
|
|
0
|
0
|
|
0
|
my $time = m/ will start at (.*)$/ && $1; |
16
|
0
|
|
0
|
|
|
0
|
$time ||= m/\(([^\-]+) -/ && $1; |
|
|
|
0
|
|
|
|
|
17
|
0
|
0
|
|
|
|
0
|
$time =~ tr/\x{a0}/ / if $time; |
18
|
0
|
|
|
|
|
0
|
$time; |
19
|
|
|
|
|
|
|
}, |
20
|
3
|
|
|
|
|
29
|
\&datetime, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @end_time = ( |
24
|
|
|
|
|
|
|
sub { |
25
|
0
|
|
0
|
0
|
|
0
|
my $time = m/- ([^)]+)\)$/ && $1; |
26
|
0
|
0
|
|
|
|
0
|
$time =~ tr/\x{a0}/ / if $time; |
27
|
0
|
|
|
|
|
0
|
$time; |
28
|
|
|
|
|
|
|
}, |
29
|
3
|
|
|
|
|
12
|
\&datetime, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my %entrants = ( |
33
|
3
|
|
|
0
|
|
15
|
sort_by => [ 'TEXT', sub { s/^By // } ], |
|
0
|
|
|
|
|
0
|
|
34
|
|
|
|
|
|
|
uri => '@href', |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $round = scraper { |
38
|
0
|
0
|
|
0
|
|
0
|
process '.', 'round' => [ 'TEXT', sub { m/^Round (\d+) / && $1 } ], |
|
0
|
|
|
|
|
0
|
|
39
|
|
|
|
|
|
|
'start_time' => [ 'TEXT', @start_time ]; |
40
|
0
|
|
|
|
|
0
|
process 'a', 'end_time' => [ 'TEXT', @end_time ], |
41
|
|
|
|
|
|
|
'uri' => '@href'; |
42
|
3
|
|
|
|
|
12
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
scraper { |
45
|
0
|
|
|
0
|
|
|
process '//ul[1]//li/a', 'entrants[]' => \%entrants; |
46
|
0
|
|
|
|
|
|
process '//ul[2]//li', 'rounds[]' => $round; |
47
|
3
|
|
|
|
|
25
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |