As you can probably tell if you read this site, I'm a fan of Delicious
. I regularly bookmark sites, images, or files I've found on the Web at Delicious and add a note or summary. Half of my motivation is finding links
I want to get back to and half is sharing the link with others. That's why I also auto-post my Delicious links here once a day and mark them with "gathered from delicious".
Over on the other side of the Web I use Google Reader
to keep up with the world. So naturally I find a lot of interesting links there and want to post them to Delicious. 90% of time I just click to the original source and hit the Delicious Bookmark
button in my browser if I want to post the link. But Google Reader has a feature similar to Delicious called Google Reader Shared Items
. If there's something I know I want to share even without visiting the original source, I just click a button and it's shared with the world.
But what if I want to cross the streams? I already have something that imports links from Delicious to my blog, I like their service for searching links, and it seems like I should be able to easily bookmark within Google Reader for the 10% of links I share there. Well, of course Google doesn't offer that integration because they have a competing product. In that case: Greasemonkey to the rescue, no? Well, I tried every script that attempts to add a Delicious button to Google Reader
and none of them worked. (I'm guessing Google is either actively thwarting these scripts, or the script authors don't have time to keep up with Google's HTML changes.) So it was time to roll my own. But I don't want to keep up with Google's changes either, so Greasemonkey is out. There had to be a better way.
Google offers the shared items as an ATOM feed which makes scripting them fairly easy. You can find your shared items feed by logging into Google Reader, clicking "shared items" in the top-left menu, click "at this webpage" in the shared items note, and then you'll find the URL at the "atom feed" link in the popup. (shew.) I decided to import my Google Reader shared items into Delicious with a Perl script I can run on a schedule. Since there are so many Greasemonkey scripts out there to do this kind of thing I thought it might be worth sharing:
(click for the source)
To use this script you'll need a couple of Perl modules: XML::Atom::Syndication
for parsing the Google Reader feed and Net::Delicious
for posting via the Delicious API
. Once installed, edit the script to include your Google Reader shared items feed URL, Delicious user/pass, and then save the file as greadertodelicious.pl
. Run the script every so often with
, and your Google Reader shared items should start showing up at Delicious.
Here are a couple snags I hit. You can tag items at Google Reader, but unfortunately Google doesn't make your tags available in the shared items feed. For now I'm simply tagging imported items with "googlereader", and adding appropriate tags at Delicious. I also didn't want to import all of my older shared items, so in the script I set a start date with
and compare it with each shared item's cryptically labeled
—as it turns out that's the time the item was shared as a Unix-ish timestamp. If the item was shared before the start date set in the script, it's not posted to Delicious.