Google Reader Filter

By Elad Ossadon Last update Jun 9, 2011 — Installed 53,220 times.

Only filters by title

in
Subscribe to Only filters by title 7 posts, 4 voices



Grant Barrett User

This script only filters by title. It doesn't filter by the description or links, so the utility is very limited.

 
Greg Bray Scriptwright
Chrome

The Google Reader Plus Chrome Extension lets you filter by author, tag, date and source. It looks like it is based on a modified version of this code. More details at https://code.google.com/p/googlereaderplus/wiki...

 
confluence User
FirefoxX11

You can make a simple change to the script source to also include the snippet of the body that you can see in the list view. I insert a space between the title and the snippet. I follow at least one feed in which the information I need to filter on is near the top of the entry and always included in the snippet, which makes this pretty helpful to me:

Find this line:
var title=element.getElementsByTagName("h2")[0].textContent;

Below it add these lines:
var snippet=element.getElementsByClassName("snippet")[0].textContent;
title = title+" "+snippet

 
trent25 User
Firefox

confluence, thank you very much for those couple of lines of code. That's exactly what I needed.
I have posts that sometimes have the same title but actually contain unique content (job search queries, where the job title is identical, but for different job postings). And this solves the problem of having them erroneously marked as dupes.

By the way, would it be possible, just when filtering for duplicates, to look at the url that the title links to? Because I believe that would be the definitive way for looking for duplicate posts that link to the same content.

And thank you Elad for a great script, it makes sifting thru my RSS feeds much easier.

 
confluence User
FirefoxX11

trent25, glad I could help. :) As I discovered when looking more closely at Reader in Firebug, the snippet can sometimes contain more of the body text than you can actually see in list view, so sometimes you may get a surprising match.

 
confluence User
FirefoxX11

I just discovered something very useful. The column with the name of the feed is always present -- it's just invisible when you're looking at an individual feed rather than a folder which contains multiple feeds. That means that if you include it in the string to match, you can construct filters for specific feeds, and they will work even when you access the feed by itself!

If you want to do that, change the relevant part of the script to this:

var source_title=element.getElementsByClassName("entry-source-title")[0].textContent;
var title=element.getElementsByTagName("h2")[0].textContent;
var snippet=element.getElementsByClassName("snippet")[0].textContent;
title = source_title + " " + title + " " + snippet

This concatenates the feed title, post title and snippet into one string, with spaces in between.

Now you can write filters like this:

^Slashdot.*Windows

You may need special regex-fu if you have e.g. a feed called "Foo" and one called "Foo Bar", and you don't want Foo rules to apply to Foo Bar, unless you rename them in Reader or use more distinct separators than spaces between the different fields. That may be something you want to do if you want to be able to match things only in the title. You can change the spaces in my code snippet to whatever works best for you. I couldn't think of any particularly elegant separators which definitely wouldn't clash with anything and wouldn't require escaping in regexes.

Anyway, I have some very specific rules for very specific feeds, and now I can use them without having them apply globally to completely unrelated stuff. :D

 
confluence User
FirefoxX11

Minor bug: if you share an item, the source column changes to say "shared by you" -- so thereafter any filters which rely on the source column will stop working.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel