line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use utf8; |
2
|
1
|
|
|
1
|
|
7
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
40
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::JSONLDExtractor'; |
5
|
|
|
|
|
|
|
with 'NewsExtractor::Role::ContentTextExtractor'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use HTML::ExtractContent; |
8
|
1
|
|
|
1
|
|
255
|
use Importer 'NewsExtractor::TextUtil' => ('html2text', 'reformat_dateline'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
9
|
1
|
|
|
1
|
|
6
|
use Importer 'Ref::Util' => ('is_hashref'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
29
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
11
|
|
|
|
|
|
|
my ($self) = @_; |
12
|
|
|
|
|
|
|
my $name; |
13
|
0
|
|
|
0
|
0
|
|
my $author = $self->schema_ld->{author}; |
14
|
0
|
|
|
|
|
|
if (is_hashref($author) && exists($author->{"name"})) { |
15
|
0
|
|
|
|
|
|
$name = $author->{"name"}; |
16
|
0
|
0
|
0
|
|
|
|
} else { |
17
|
0
|
|
|
|
|
|
$name = $author; |
18
|
|
|
|
|
|
|
} |
19
|
0
|
|
|
|
|
|
return $name; |
20
|
|
|
|
|
|
|
} |
21
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
around dateline => sub { |
23
|
|
|
|
|
|
|
my $orig = shift; |
24
|
|
|
|
|
|
|
my $ret = $orig->(@_); |
25
|
|
|
|
|
|
|
return reformat_dateline($ret, '+08:00'); |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
around '_build_content_text', sub { |
29
|
|
|
|
|
|
|
my $orig = shift; |
30
|
|
|
|
|
|
|
my ($self) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if (my $el = $self->dom->at('article.post-article')) { |
33
|
|
|
|
|
|
|
my $extractor = HTML::ExtractContent->new; |
34
|
|
|
|
|
|
|
my $html = $extractor->extract("$el")->as_html; |
35
|
|
|
|
|
|
|
my $text = html2text( $html ); |
36
|
|
|
|
|
|
|
return $text; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return $orig->($self); |
40
|
|
|
|
|
|
|
}; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |