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