Plagger::Plugin::Filter::LivedoorKeywordUnlink - Strip Livedoor keyword links from fulltext feeds


Plagger documentation Contained in the Plagger distribution.

Index


Code Index:

NAME

Top

Plagger::Plugin::Filter::LivedoorKeywordUnlink - Strip Livedoor keyword links from fulltext feeds

SYNOPSIS

Top

  - module: Filter::LivedoorKeywordUnlink

DESCRIPTION

Top

This plugin strips link to Livedoor keyword links in feeds.

AUTHOR

Top

Tatsuhiko Miyagawa

SEE ALSO

Top

Plagger, Plagger::Plugin::Filter::HatenaDiaryKeywordUnlink


Plagger documentation Contained in the Plagger distribution.

package Plagger::Plugin::Filter::LivedoorKeywordUnlink;
use strict;
use base qw( Plagger::Plugin );

sub register {
    my($self, $context) = @_;
    $context->register_hook(
        $self,
        'update.entry.fixup' => \&update,
    );
}

sub update {
    my($self, $context, $args) = @_;
    my $body = $args->{entry}->body;

    my $count = $body =~ s!<a .*?href="http://keyword\.livedoor\.com/w/.*?"[^>]*>(.*?)</a>!$1!g;

    if ($count) {
        $context->log(info => "Stripped $count links to Livedoor Keyword");
    }

    $args->{entry}->body($body);
}

1;

__END__