feedfilter gem - feed filter and rules for easy (re)use
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib prep 1.1.1 Jan 18, 2015
test
.gitignore
HISTORY.md
Manifest.txt prep 1.1.1 Jan 18, 2015
README.md Update README.md Feb 7, 2017
Rakefile add include filter Jan 18, 2015

README.md

feedfilter gem - feed filter and rules for easy (re)use

Usage

strip_ads (in AdsFilter module)

require 'feedfilter'

include FeedFilter::AdsFilter      # lets us use strip_ads


before_snippet =<<EOS
<div class="feedflare">
 <a href="http://feeds.feedburner.com/~ff/Rubyflow?a=1wUDnBztAJY:fzqBvTOGB9M:3H-1DwQop_U">
   <img src="http://feeds.feedburner.com/~ff/Rubyflow?i=1wUDnBztAJY:fzqBvTOGB9M:3H-1DwQop_U" border="0"></img>
 </a>
</div>
EOS


snippet = strip_ads( before_snippet )

puts snippet

Use Text Patterns (Regex) for Filters

Ads Example:

FEEDFLARE_ADS = %r{
     <div[^>]*?
        class=("|')feedflare\1
        [^>]*?>
          .*?
     <\/div>
       }mix

FEEDBURNER_BUGS = %r{
      <img[^>]*?
         src=("|')(:?http:)?//feeds\.feedburner\.com/~r/[^>]+?\1
         .*?>
       }mix

...

or as one-liners (if you prefer)

FEEDFLARE_ADS   = %r{<div[^>]*?class=("|')feedflare\1[^>]*?>.*?<\/div>}mi
FEEDBURNER_BUGS = %r{<img[^>]*?src=("|')(:?http:)?//feeds\.feedburner\.com/~r/[^>]+?\1.*?>}mi
...

License

The feedfilter scripts are dedicated to the public domain. Use it as you please with no restrictions whatsoever.

Questions? Comments?

Send them along to the wwwmake Forum/Mailing List. Thanks!