Synchronizing Opera bookmarks with Perl, Org, and git

Who here like me still uses Opera (specifically Opera 12 on Linux)? It's being abandoned, the bugs are piling up, and more websites are not rendering correctly on it. However, the combination of keyboard shortcuts and some specific features like editing+applying source code makes me still stick to it.

The Opera makers provide a service called Opera Link that can synchronizes your browser bookmarks and a few other stuffs between computers and mobile devices. However I prefer not to use it and rely on some good ol' tools instead.

I also happen to be a fan of Org so Org will be the master document.

The steps that I describe here might be too much of a hassle, but I like it and thus share it.

First, you install the CPAN module App::ConvertOperaBookmarksToOrg which includes the utilities adr2org and org2adr.

Then you convert your Opera bookmarks to an Org document with this command:

% adr2org -T ~/.opera/bookmarks.adr > repo/opera-bookmarks.org

opera-bookmarks.org is the actual document that you will be putting into git repository and synchronize between computers. It is convenient to edit via Emacs, and is more easily diff-able by removing volatile bits that change or random written by Opera (like the ID field). The -T option is to exclude the Trash folder, which I don't care for.

In another computer, you convert back to Opera .adr format using:

% org2adr repo/opera-bookmarks.org > ~/.opera/bookmarks.adr

Make sure that Opera is not running when you override its bookmarks file.

7 Comments

I use Opera 12 on Linux. You know it has the ability to export bookmarks as HTML, using the same format Netscape used to use many moons ago. I believe it is mostly round-trippable.

Similarly, Firefox can still be made to export/import its bookmarks to a Netscape-format HTML file in a way that's scriptable and mostly round-trippable. That's what I use to synchronize my bookmarks.

Maybe not useful for you, at least not anymore, but FYI, this is a module I wrote, and still maintain, to parse Opera ADR files, part of Bookmarks::Parser:

https://metacpan.org/pod/Bookmarks::Opera

Sorry, correction: I didn't write it originally, but I fixed a lot of bugs and acquired co-maint for it :-)

Leave a comment

About perlancar

user-pic #perl #indonesia