line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::ChinaTimes; |
2
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
34
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::JSONLDExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
321
|
use Importer 'NewsExtractor::TextUtil' => qw( html2text ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub content_text { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
|
|
|
|
|
|
# my $text = $self->schema_ld->{articleBody} // $self->schema_ld->{description} // ''; |
11
|
0
|
|
|
|
|
|
my $body = $self->tx->result->dom->at("div.article-body"); |
12
|
0
|
|
|
|
|
|
$body->find(".article-hash-tag")->map('remove'); |
13
|
0
|
|
|
|
|
|
my $text = html2text( $body->content ); |
14
|
0
|
|
|
|
|
|
return $text; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |