Code for Stripping Google Ads from RSS
In a
previous entry in the Googleplex Blog and on
O'Reilly I mentioned that Google was beta testing contextual AdSense style ads in RSS and Atom feeds.
One company immediately placing these ads in its RSS feeds is Weblogs, Inc., whose Prez Jason Calacanis is annoyed with "folks who take our feeds and republish them without premission to their websites... these folks wrap our content in ads..."
At least in the current implementation, it's easy to remove these ads in a feed display application because they are implemented as HTML tables, which really have no business in syndication feeds. Here's a PHP function that uses regular expression pattern matching to remove all table rows from each item description in a feed:
Here's the Weblogs
Unofficial Google Weblog RSS feed (note the embedded Google ads in item descriptions), and the same
feed displayed using this code with ads stripped on
Syndication Viewer.
Posted by Harold Davis at May 2, 2005 04:36 PM