« NewsExtractor/SiteSpecificExtractor/www_peopo_org.pm
↑ Summary
NewsExtractor/SiteSpecificExtractor/estate_ltn_com_tw.pm »
| 1 | package NewsExtractor::SiteSpecificExtractor::www_ksnews_com_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::GenericExtractor'; | |
| 5 | |||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => qw( normalize_whitespace ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | sub headline { |
|
Subroutine
headline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 9 | 0 | my ($self) = @_; | |
| 10 | 0 | my $el = $self->dom->at("div.contents_page h1.title_"); | |
| 11 | 0 | return $el->text; | |
| 12 | } | ||
| 13 | |||
| 14 | 0 | ▶ | sub dateline { |
|
Subroutine
dateline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 15 | 0 | my ($self) = @_; | |
| 16 | 0 | my $el = $self->dom->at(".date"); | |
| 17 | 0 | return $el->text; | |
| 18 | } | ||
| 19 | |||
| 20 | 0 | ▶ | sub journalist { |
|
Subroutine
journalist: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 21 | 0 | my ($self) = @_; | |
| 22 | 0 | my $text = $self->content_text; | |
| 23 | 0 | my ($name) = $text =~ m{\b (?:\V+[╱/])? 記者(.+?) [//]? 報導\b}x; | |
| 24 | 0 | return $name; | |
| 25 | } | ||
| 26 | |||
| 27 | 0 | ▶ | sub content_text { |
|
Subroutine
content_text: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 28 | 0 | my ($self) = @_; | |
| 29 | 0 | my $el = $self->dom->at(".edit > section"); | |
| 30 | 0 | my $text = $el->all_text; | |
| 31 | |||
| 32 | 0 | my $headline = $self->headline; | |
| 33 | 0 | $text =~ s/\A\s+$headline\s+//s; | |
| 34 | 0 | $text = normalize_whitespace($text); | |
| 35 | 0 | return $text; | |
| 36 | } | ||
| 37 | |||
| 38 | 1 | 1; | |