Export all the RSS feeds in Opera

I wanted to take a backup of my Opera profile including the RSS feeds. I find it convenient to read the feeds from Opera instead of an external viewer. When I used the standard export feeds option (File –> Import and Export –> Export Feed List), I realised that only those feeds that I am currently subscribed to are the ones that got exported. Aaah, that is a problem ! I have a lot of feeds in my feeds-list and I keep turning on and off a few of them as and when I feel I can’t keep up with them (sigh, the problem of over-information !)

I searched a bit to find out if there was any flag I am missing in the configuration. I didn’t find any. So, I thought, why not write a small script to do this for me. The first choice of language was python, but then I thought, naa, let me try something groovy 😀

Simple steps to do achieve this

  1. Find out where and how the feeds are currently stored in Opera
  2. If it is a standard format (which mostly it would be), find a library in Java that will parse that
  3. Convert that into an OPML file – again using some existing Java library

The answers for the above

  1. The feeds are stored in a .ini file (yaaay ! +1 for the Opera team for picking a simple format). They are stored in the mail directory (you can find that using about:opera and checking the mail directory). In the mail directory, the feeds are stored in a file named incoming1.txt (or any number of incoming.txt) files
    1. The format is simple. Each feed has a name, URL and whether you have subscribed to it or not in its own section. Here is an example
        [Feed 95]
        Name=good coders code, great reuse
        URL=http://feeds.feedburner.com/catonmat
        Update Frequency=3600
        Subscribed=1
  2. Following this suggestion, I started with ini4j, but soon realised that it couldn’t handle UTF-8 files. And the feeds file is an UTF-8 file. So, I decided to checkout apache commons. The main library required for this is the commons-configuration, but this requires a bunch of dependencies
    1. Commons-collections
    2. commons-lang
    3. commons-logging
  3. And the exported file is an OPML file, specifically an OPML 1.0 file. The library of choice seems to be ROME for this. And ROME also has an OPML output generator too. Sweet ! The dependencies for this are
    1. rome-1.0.jar (the ROME library)
    2. opml-0.1.jar (the OPML generator)
    3. jdom.jar (a dependency for ROME)

I must say, I was a little annoyed with the list of dependencies, but then that is the Java world, so I shrugged my shoulders and continued.

The IniToOPML.groovy file exports the ini file to an opml 1.0 file. I couldn’t figure out why the <head></head> node was not getting generated, but for now, this seems to work fine.

I am not comfortable with Maven yet to write a pom.xml to automatically download the required packages for the binary. So, for now, it is source only (may be this way I will learn Maven !).