A fellow former Bloglines user has asked me whether
I found a way to backup Google Reader subscriptions
into an OPML file from cron, as we used to
do with our Bloglines accounts.
A quick search turned up this,
which,
from the look of it,
in order for it to work
requires every feed to be
explicitly marked with a tag which
is set up as public.
This by itself is rather cumbersome,
and you have to remember to do that for every new
feed you subscribe to,
otherwise you’ll defeat the purpose of making
periodic backups in the first place.
Luckily, there is a better solution.
There is a nice little module on CPAN,
WebService::Google::Reader by gray,
which uses an unofficial Google Reader API
to do various nifty things with your Google Reader
subscription,
including OPML export.
This means that after installing the module
you can simply put the following command
into your crontab (only command itself is shown,
see crontab(5) manual page to find
out what else you will want to put in there):
env GOOGLE_USERNAME=[email protected] \
GOOGLE_PASSWORD=your-user-password \
perl -MWebService::Google::Reader -e \
'print WebService::Google::Reader->new(
username => $ENV{GOOGLE_USERNAME},
password => $ENV{GOOGLE_PASSWORD})->opml' \
> /where/to/put/greader.opml
You will have to make the above to be one long line to satisfy
crontab syntax, and of course remember to use a real username,
password, and the path to the resulting OPML file.
Unfortunately, the most recent version
of the module (which is 0.03 at the time of this writing)
has a minor bug which prevents
the opml() method from working correctly.
So you will need to do a little patching.
Before installing the module,
edit the source file lib/WebService/Google/Reader/Constants.pm,
look for a string subscribtions,
and fix the spelling
(finding correct spelling is left as an exercise for the reader).
Then proceed installing the module as usual.
Hopefully, this step won’t be necessary in a couple of days’ time
when a new version of the module is released.
If you are a FreeBSD user like myself,
you may choose instead to
fetch a skeleton of the port of the module.
Unpack it in /usr/ports/www/
and install it as you would any other port.
I intend to add the port to the ports collection as soon
as our current ports freeze is over.
Enjoy!