| 1 | package NewsExtractor::SiteSpecificExtractor::www_allnews_tw; | ||
| 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::SiteSpecificExtractor'; | |
| 5 | |||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => 'normalize_whitespace'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | sub dom { |
|
Subroutine
dom: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 9 | 0 | my ($self) = @_; | |
| 10 | 0 | return $self->tx->res->dom; | |
| 11 | } | ||
| 12 | |||
| 13 | 0 | ▶ | sub headline { |
|
Subroutine
headline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 14 | 0 | my ($self) = @_; | |
| 15 | 0 | my $el = $self->dom->find('meta[property="og:title"]')->first; | |
| 16 | 0 | return $el->attr('content'); | |
| 17 | } | ||
| 18 | |||
| 19 | 0 | ▶ | sub dateline { |
|
Subroutine
dateline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 20 | 0 | my ($self) = @_; | |
| 21 | 0 | my $el = $self->dom->find('h2.newsTitle ~ div.desc > div:nth-child(1) > span:nth-child(1)')->first; | |
| 22 | 0 | return $el->text(); | |
| 23 | } | ||
| 24 | |||
| 25 | 0 | ▶ | sub content_text { |
|
Subroutine
content_text: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 26 | 0 | my ($self) = @_; | |
| 27 | 0 | my $el = $self->dom->find('meta[property="og:description"]')->first; | |
| 28 | 0 | return normalize_whitespace( $el->attr('content') ); | |
| 29 | } | ||
| 30 | |||
| 31 | 0 | ▶ | sub journalist { |
|
Subroutine
journalist: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 32 | 0 | my ($self) = @_; | |
| 33 | 0 | my ($txt) = $self->content_text =~ m/\A【(本報記者.+?報導)】/; | |
| 34 | 0 | return $txt; | |
| 35 | } | ||
| 36 | |||
| 37 | 1 | 1; | |