« blib/lib/NewsExtractor/Article.pm
↑ Summary
blib/lib/NewsExtractor/SiteSpecificExtractor/news_tvbs_com_tw.pm »
| 1 | package NewsExtractor::SiteSpecificExtractor::ChinaTimes; | ||
| 2 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | extends 'NewsExtractor::JSONLDExtractor'; | |
| 5 | |||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => qw( html2text ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | sub content_text { | ||
| 9 | 0 | ▶ | my ($self) = @_; |
|
Subroutine
content_text: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 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 | 1; | |