Thursday, March 08, 2007

Lost your Akregator feed list? Get it back from the archived data

While using my laptop via ssh (with X forwarding) to read my Akregator's feeds the Internet connection failed and Akregator was forced to close. Once back home I fired up Akregator to finish reading my feeds and to my surprise my feed list was gone!.

The feeds.opml file that contains the list was empty and the feeds.opml~ backup file had only the default entries.

After the shock and some failed recovery attempts I found that the archived feed data was intact (i.e. ~/.kde/share/apps/akregator/Archive) and a closer look at the contents of that directory revealed that the archive filenames are in fact the feed's URL addresses with some minor changes (i.e. "/"'s replaced with "_"'s).

With some bash magic I was able to recover the feed list using the following script:

#!/bin/sh

list=`ls http*mk4`

for i in $list; do

feed=`echo $i | sed -e 's/http___/http:\/\//' \
| sed -e 's/_/\//g' | sed -e 's/.mk4//'`
echo "Adding $feed"
`akregator -a $feed`
done

Copy the script inside the archives directory and make sure you are inside that directory before running it. Once running you will see how Akregator is fired up and the feed list starts filling automatically.

Make sure to make the script executable (i.e. chmod +x script.sh) or simply run it using the bash interpreter (i.e. bash script.sh).

On the down side I was unable to recover the group information and all the feed's were added to the Imported group inside Akregator.

As an additional note I must mention that in the archive directory there are two binary files that seem to contain all the feed list information (including groups). One of the files is called "feedlistbackup.mk4" and it's contents is almost identical to that of the feeds.opml file with some additional binary elements added to it. Maybe someone that knows the binary format can create a simple program to recover the feed list from that file including group information.

3 comments:

  1. Found a blog post by Jason Pollock that has some information on how to recover the Akregator feeds from the feedlistbackup.mk4 binary file I mentioned as additional note.

    Seems my blog is actually being useful to others.

    ReplyDelete
  2. Anonymous11:50 PM

    This seems to be the script I was looking for. But there must be something I did wrong. Just one feed is coming back and the script stops - "saying" nothing but:

    kbuildsycoca running...
    QFile::open: No file name specified

    ... any idea, what went wrong?

    (Excuse my horrific english.)

    ReplyDelete
  3. Not really sure how you are using the script but that error message does not make any sense.

    I just tried the script with the latest akregator (1.2.50) and it works fine. Maybe your archive files are lost or corrupt.

    You can try the method mentioned in the first comment of this blog post by Jason Pollock. It is better than this one.

    ReplyDelete