Changeset 396
- Timestamp:
- 03/14/06 19:02:27
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Filter/StripRSSAd.pm
r394 r396 13 13 sub update { 14 14 my($self, $context, $args) = @_; 15 my $body = $self->filter($args->{entry}->body );15 my $body = $self->filter($args->{entry}->body, $args->{entry}->link); 16 16 $args->{entry}->body($body); 17 17 } 18 18 19 19 sub filter { 20 my($self, $body ) = @_;20 my($self, $body, $link) = @_; 21 21 22 22 # rssad.jp 23 23 my $count = $body =~ s!<br clear="all" /><a href="http://rss\.rssad\.jp/rss/ad/.*?" target="_blank".*?><img .*? src="http://rss\.rssad\.jp/rss/img/.*?" border="0"/></a><br.*?>!!; 24 Plagger->context->log(debug => "Stripped rssad.jp ad ") if $count;24 Plagger->context->log(debug => "Stripped rssad.jp ad on $link") if $count; 25 25 26 26 # plaza.rakuten.co.jp 27 27 $count = $body =~ s!<br clear?=all /><br><SMALL>\n(?:<SCRIPT LANGUAGE="Javascript">\n<\!--\nfunction random\(\).*?infoseek.*?RssPlaza.*</SCRIPT>)?\n<NOSCRIPT>.*?infoseek.*?RssPlaza.*?</NOSCRIPT>\n</SMALL>!!s; 28 Plagger->context->log(debug => "Stripped plaza.rakuten ad ") if $count;28 Plagger->context->log(debug => "Stripped plaza.rakuten ad on $link") if $count; 29 29 30 30 # Google AdSense for Feeds … … 34 34 $count += $body =~ s!<table [^>]*>\n\s*(?:<tr>\n\s*<td><(?:defanged-)?span[^>]*> <br[^>]*></(?:defanged-)?span></td>\n\s*</tr>\s*\n\s*)?<tr>\n\s*<td><a href="http://imageads\.googleadservices\.com/pagead/imgclick/[^"]*"[^>]*>\n<img [^>]* src="http://imageads\.googleadservices\.com/pagead/ads\?[^"]*" / ?></a></td>\n\s*</tr>\n\s*<tr>\n\s*<td><div align="right">(?:<font [^>]*>)?<a href="http://www\.google\.com/ads_by_google\.html" [^>]*>Ads by Google</a>(?:</font>)?</div></td>\n\s*</tr>\n\s*</table>!!s; 35 35 36 Plagger->context->log(debug => "Stripped Google AdSense for feeds ") if $count;36 Plagger->context->log(debug => "Stripped Google AdSense for feeds on $link") if $count; 37 37 38 38 # Pheedo ads 39 39 $count = $body =~ s!<br /><br />\n<a href="http://www\.pheedo\.com/click\.phdo\?feedUrl=.*?"*?><img border="0" src="http://www\.pheedo\.com/img\.phdo\?feedUrl=.*?" /></a>!!; 40 Plagger->context->log(debug => "Stripped Pheedo Ads") if $count; 40 Plagger->context->log(debug => "Stripped Pheedo Ads on $link") if $count; 41 42 # FeedBurner ads 43 $count = $body =~ s!<p><a href="http://feeds\.feedburner\.com/~a/\w+\?a=\w+"[^>]*><img src="http://feeds\.feedburner\.com/~a/\w+\?i=\w+" border="0"></img></a></p>!!; 44 Plagger->context->log(debug => "Stripped FeedBurner Ads on $link") if $count; 41 45 42 46 $body;
