Wednesday, July 23, 2008

Move RSS Feeds to NetNewsWire

Like Dave Thomas, I recently decided to give a try as an RSS reader. Overall the experience hasn't been great, but it wasn't poor enough that I thought the effort to switch was justified.

And then I decided to quit my job*. Next week will by my last week with ThoughtWorks and I'll need to turn in my laptop. I tend to store as much as possible online so this type of situation isn't a big deal, but going with seems to have been a decision in the wrong direction. Maybe stores my RSS feeds online somewhere, but it wasn't immediately obvious to me.

A quick google search revealed a Mac OSX Hint on how to dump your RSS feeds to the command line. This was quite helpful, but what I really needed was an OPML file that I could send to NetNewsWire.

I wrote the following script for anyone that finds themselves in the same situation. This script will grab all the feeds and write them to an OPML file. I'm sure it can be cleaned up or done more easily, but this works.

feeds = %x[IFS=$'\n';for i in $(find ~/Library/Mail/RSS/ -name "Info.plist");do grep "<string>http://" $i | sed "s/.*\(http[^<]*\).*/\1/";done].split("\n")
feeds = feeds.collect { |element| element.gsub(/<string>/, "<outline xmlUrl=\"") }
feeds = feeds.collect { |element| element.gsub(/<\/string>/, "\"/>") }
xml = <<-eos
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.1">
eos"mail_app_export.ompl", "w") { |file| file << xml }

note: This file works in NetNewsWire, but I had better success by logging on to and importing on their website. When you import on their website it pulls the feed names and other information. The NetNewsWire didn't seem to pull the additional information.

*For those interested, I'm joining DRW Trading.
Post a Comment