HowTo: Sync Google Reader With Delicious Bookmarks

How To, Linux, Ubuntu

  • 10
  • 14
  • 1

I’ve been using Google Reader for about as long as I’ve been using Delicious. When it comes to finding new content I greatly prefer Google Reader over any other resource available, I also prefer Delicious over any other method for storing bookmarks. While sharing and starring items in my feed reader is convenient, it has steadily caused me to become remiss in saving items to Delicious over the years.

In my search to find a convenient method for syncing items from my account to Delicious I ran across a script by Rick Mans to just that. Unfortunately, the method he uses to attempt to detect recommended tags for future bookmarks often leaves the saved bookmarks without any tags at all or with too many tags. Which left me having to go back later and edit each bookmark to add relevant tags, essentially negating any time saved by using automated syncing.

Luckily over the past year I’ve gained a cursory knowledge of PHP so I decided to modify the script to work a bit differently, though I did rely quite heavily on a friend for guidance. I’ve set up a page for the script on Google code which contains the documentation needed to configure the script. For convenience sake I’ve reiterated them here.

First, grab a copy of the script.

Open the file greader2delicious.php with your text editor of choice and follow these instructions to get started. In order for the script to function you will need to insert your Delicious Bookmarks username and password between the quotation marks on lines 26 and 27 respectively.

You will also need to insert your unique Google Reader ID (a string of 20 digits) into line 43 of the script:

$googleReaderURI = “http://www.google.com/reader/public/atom/user/20-digit-ID-goes-here/state/com.google/broadcast”;

If you are unsure how to find your 20-digit ID go to Google Reader and click “Sharing settings” below your friends list. You should see your 20-digit ID under the heading “Choose a custom URL”:

http://www.google.com/reader/shared/20-digit-ID

That takes care of configuring the script itself, in order to run the script you’ll need to have the packages php5, php-cli, and php5-curl installed. You can install them by entering the following command into the terminal:

sudo apt-get install php5 php-cli php5-curl

Once the installation has finished you can run the script by using the command below (which assumes that you’ve saved the script in your home folder):

php5 -f ~/greader2delicious.php

If you’ve properly configured the script you should see many new bookmarks in your delicious account assuming you’ve used the “share” function on Google Reader before. If you notice, none of them will have any tags and you may have seen the following error in the terminal after running the script:

Notice: Undefined index

To take advantage of modified tag function of my script use the “Share with note” option in Google Reader. The script searches for the following syntax in your note:

TAGS(tag1 tag2 tag3)

Wherein tag1 tag2 tag3 and so on are replaced with your tags, such as cars school funny etc. Sharing bookmarks is also possible using this method, simply use the tag for:username (replacing “username” with the Delicious username of the person you would like to share the bookmark with). To sync older items simply add ?n=100 to the end of the Google Reader URI on line 43 of the script, replacing “100″ with the number of previously shared items you wish to retrieve just remember to remove this tidbit once you’ve run the script once so you don’t redundantly attempt to save the same bookmarks again.

Note: Previously shared items will in all likelihood not have the TAGS(tag1 tag2 tag3) pseudofunction syntax and will therefor be synced without any tags to Delicious.

If you’ve made it this far and want to make the entire syncing process even easier why not run the script on a regular basis to automate your syncing entirely. You can do so easily by using cron. Simply enter the line below into the terminal:

crontab -e

Then paste/type the following into the CLI based editor:

0 0 * * * php5 -f ~/.scripts/gr2del.php

(Hit Ctrl+x to exit and type Y when prompted to save changes)

What this does is tells your system to run the script at 12:00 AM every day. If you’d like to run it less often visit this tutorial for more instructions. If you have any problems running the script feel free to leave a comment or send me an email via the contact form in my contact page.

2 Comments

  • 1. Rick Mans  |  January 15, 2010 at 12:12 am

    Nice work Patrick!

  • 2. Patrick Micka  |  January 15, 2010 at 12:36 am

    Thanks, couldn’t have done it without your great script.

Leave a Comment

(required)

(required), (Hidden)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TrackBack URL  |  RSS feed for comments on this post.


 

Archives

Categories

Blogroll