line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_twreporter_org; |
2
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
3
|
1
|
|
|
1
|
|
38
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::GenericExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
440
|
use Importer 'NewsExtractor::TextUtil' => 'u'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub dateline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
0
|
|
|
|
|
my $el = $self->dom->at('meta[itemprop=dateModified][content]') or return; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $dateline; |
13
|
0
|
0
|
|
|
|
|
if (my ($y,$m,$d) = $el->attr('content') =~ m/([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})/) { |
14
|
0
|
|
|
|
|
|
$dateline = u(sprintf('%04d-%02d-%02d', $1, $2, $3)); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return $dateline; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub journalist { |
21
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
22
|
0
|
|
|
|
|
|
my $txt = $self->dom->find('span[class^="metadata__AuthorName"]')->map('all_text')->uniq()->join('、'); |
23
|
0
|
|
|
|
|
|
return u($txt); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |