|
Revision 856
(checked in by miyagawa, 6 years ago)
|
merge from trunk to plagger-server for Enclosures support and such. Sorry for the big commit
|
| Line | |
|---|
| 1 |
package Plagger::Plugin::Filter::LivedoorKeywordUnlink; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Plugin ); |
|---|
| 4 |
|
|---|
| 5 |
sub register { |
|---|
| 6 |
my($self, $context) = @_; |
|---|
| 7 |
$context->register_hook( |
|---|
| 8 |
$self, |
|---|
| 9 |
'update.entry.fixup' => \&update, |
|---|
| 10 |
); |
|---|
| 11 |
} |
|---|
| 12 |
|
|---|
| 13 |
sub update { |
|---|
| 14 |
my($self, $context, $args) = @_; |
|---|
| 15 |
my $body = $args->{entry}->body; |
|---|
| 16 |
|
|---|
| 17 |
my $count = $body =~ s!<a .*?href="http://keyword\.livedoor\.com/w/.*?"[^>]*>(.*?)</a>!$1!g; |
|---|
| 18 |
|
|---|
| 19 |
if ($count) { |
|---|
| 20 |
$context->log(info => "Stripped $count links to Livedoor Keyword"); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
$args->{entry}->body($body); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
1; |
|---|
| 27 |
|
|---|
| 28 |
__END__ |
|---|
| 29 |
|
|---|
| 30 |
=head1 NAME |
|---|
| 31 |
|
|---|
| 32 |
Plagger::Plugin::Filter::LivedoorKeywordUnlink - Strip Livedoor keyword links from fulltext feeds |
|---|
| 33 |
|
|---|
| 34 |
=head1 SYNOPSIS |
|---|
| 35 |
|
|---|
| 36 |
- module: Filter::LivedoorKeywordUnlink |
|---|
| 37 |
|
|---|
| 38 |
=head1 DESCRIPTION |
|---|
| 39 |
|
|---|
| 40 |
This plugin strips link to Livedoor keyword links in feeds. |
|---|
| 41 |
|
|---|
| 42 |
=head1 AUTHOR |
|---|
| 43 |
|
|---|
| 44 |
Tatsuhiko Miyagawa |
|---|
| 45 |
|
|---|
| 46 |
=head1 SEE ALSO |
|---|
| 47 |
|
|---|
| 48 |
L<Plagger>, L<Plagger::Plugin::Filter::HatenaDiaryKeywordUnlink> |
|---|
| 49 |
|
|---|
| 50 |
=cut |
|---|