Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m confident

Content filtering for news feeds

Hello,

I would really love to see some kind of (simple) content filtering for news feeds (I'm thinking of ads in html img-tags).

I don't want to disallow html globally, so i think there are two options:

1. Let the user set the html on/off option on each feed separately (this would mean some kind of advanced feed management).

2. Do some filtering on the feeds content (this would mean some kind of filter management).

Regarding the second option, here's what I did:

In feedsummary.js, line 292 [Sage 1.4.8]

if (feedItem.hasContent()) {
var description = document.createElement("div");
description.setAttribute("class", "item-desc");
if (allowEContent) {
content = feedItem.getContent();

// Apply filter
var filterList = ["http://da.feedsportal.com/*.img"];

for (var n = 0; n < filterList.length; n++) {
var filter = filterList[n].replace(/\./g, "\\.");
filter = filter.replace(/\//g, "\\/");
filter = filter.replace(/\*/g, "[^]*" + filter + "[^";

var re = new RegExp(filter, "gi");

content = content.replace(re, "[FILTER]");
}
} else {
content = SageUtils.htmlToText(feedItem.getContent());
}
description.appendChild(this.sanitizeFragment(parser.parseFragment(content, false, null, document.documentElement), feedItem.hasBaseURI() ? feedItem.getBaseURI() : feed.getLink()));
item.appendChild(description);
}

This works well, for example on http://www.heise.de/tr/news.rdf

Keep up the good work - I'm glad that Sage is under active development again!
1 person likes
this idea
+1
Reply