How To Export Starred Items From Google Reader Into HTML

I'm a big fan of Google Reader. I like to use the gold star to flag interesting posts. I wanted to export a list of these interesting posts, but couldn't find any info online on how to do this. Here's my approach. It is much simpler to do than to explain.

star1,png

1. Inside Google Reader, go to "Settings" on top right, then go to "Folders and Tags". Click the box next to "Your starred items", then use the "change sharing" pulldown to set your starred items to "Public." If you are worried about privacy, you can make your starred list private again afterwards.

star2

2. Click "View Public Page" on the "Your Starred Items" page.

star3

3. Copy the URL of this page and paste it in a text editor or Notepad. It should have a long number it, 20 or so digits. That number represents your Google Reader account.

4. Paste this url into your text editor (this is all one line)

http://www.google.com/reader/public/atom/user/99999/state/com.google/starred?n=100

and replace the string of 9s with your long 20 digit number.

Make sure when you paste in the number that the URL still has a slash before and after the number. (Note on Nial Kennedy's excellent Google API page there's a typo where he omitted the initial slash on the starred item url.)

5. Voilà -- that URL is an Atom feed for your starred items. The n=100 parameter indicates how many items you want. You can adjust it appropriately.

6. Similarly, you can get Atom feeds for your Google Reader tags, your Google Reader read items, etc. Nial has the details.

7. Digression: at this point, if you wanted, you could run your Atom feed through Yahoo Pipes to derive a new feed, dropping rows or merging in additional information.

star4

8. Now, how to go from Atom to HTML? If you knew enough XSLT, you could use a simple transformation. I tried to cook up some XSLT so folks could use an online tool like xslt.sitesfree.com. No luck; couldn't figure it out. Any XSLT gurus reading this? Advice?

9. Striking out with XSLT, I opted to use a script. I went with Ruby. Perl or Python would also work. Here's the 8 line Ruby program:

require "rubygems"
require "open-uri"
require "simple-rss"
feed = "http://www.google.com/reader/public/atom/user/99999/state/com.google/starred?n=100"
rss = SimpleRSS.parse open(feed)
rss.entries.each do |item|
puts "<li><a href='#{item.link}'>#{item.title}</a></li>\n"
end

Again, replace those 9s with your 20 digit Google Reader id.

Ruby is installed by default on 'nix and Mac; there's a Win95 version here. gem install simple-rss gets you the RSS-parsing gem if you need it.

10. Now you can undo Step #1 to reset your starred feed to private if you want.

11. Here's sample output from the script:

Join the Discussion