line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use utf8; |
2
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
26
|
extends 'NewsExtractor::GenericExtractor'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Importer 'NewsExtractor::TextUtil' => qw(reformat_dateline normalize_whitespace); |
6
|
1
|
|
|
1
|
|
254
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
my ($self) = @_; |
8
|
|
|
|
|
|
|
my $el = $self->dom->at('h2 ~ div.col span'); |
9
|
0
|
|
|
0
|
0
|
|
if ($el) { |
10
|
0
|
|
|
|
|
|
my ($ymd) = $el->all_text() =~ m<\(([0-9]{4}/[0-9]{1,2}/[0-9]{1,2})\)\z>; |
11
|
0
|
0
|
|
|
|
|
return reformat_dateline( $ymd, '+08:00' ); |
12
|
0
|
|
|
|
|
|
} |
13
|
0
|
|
|
|
|
|
return undef; |
14
|
|
|
|
|
|
|
} |
15
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
my ($x, $el); |
18
|
|
|
|
|
|
|
if ($el = $self->dom->at('h2 ~ div.col span')) { |
19
|
0
|
|
|
0
|
0
|
|
$x = $el->all_text() =~ s<\([0-9]{4}/[0-9]{1,2}/[0-9]{1,2}\)\z><>r; |
20
|
0
|
|
|
|
|
|
$x = normalize_whitespace($x); |
21
|
0
|
0
|
|
|
|
|
} |
22
|
0
|
|
|
|
|
|
unless ($x) { |
23
|
0
|
|
|
|
|
|
my $t = $self->content_text; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
my @regexps = ( |
26
|
0
|
|
|
|
|
|
qr{\A(\S+)/\S+報導\n}, |
27
|
|
|
|
|
|
|
qr{\A\S*(報導/\S+\s+攝影/\S+)\n}, |
28
|
0
|
|
|
|
|
|
qr{\A\S*(文/\S+\s+圖/\S+)\n}, |
29
|
|
|
|
|
|
|
qr{\A\S*(\S{3})\n}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
for my $re (@regexps) { |
33
|
|
|
|
|
|
|
($x) = $t =~ /$re/; |
34
|
|
|
|
|
|
|
last if $x; |
35
|
0
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
} |
37
|
0
|
0
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return $x; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
1; |