Ken Haigh leadership, productivity, and technology | about

How To Feed Twitter with Your Shared Google Reader Items

I am an avid Google Reader user. Even though the popularity of RSS readers has waned over the last year, Google Reader is still the fastest interface to consume information about the topics that interest me. How can you go wrong with a service where j/k keys are down/up?
One problem I had with Google Reader is that I wanted to easily tweet my shared items to my friends on Twitter. I found a number of solutions with RSS feed functionality such as Hootsuite and TwitterFeed, but was not happy with any of them. Some items were not tweeted and I wanted more flexibility in the scheduling of tweets and formatting. I also found services like Posterous that are integrated with Google Reader to be cumbersome. I want just want to click “shift-s” to share and move on.

After investigating the problem with inconsistent feeding, I believe I understand the issue.

The Google Reader shared items are aggregated from a number of different RSS feeds. As a result, the published dates for the entries are not consistent.  Your Google Reader shared items do not behave as a typical RSS feed where each item has a newer published date. The generic RSS feed functionality in a service such as Hootsuite uses the published date to determine the next item to pull from the feed

instead of the time when you shared the item. As a result, items that you shared will get skipped if the next item was published before the item that was just tweeted.

This problem can be solved. I created a simple bash shell script that will tweet your Google Reader shared items to Twitter by using the timestamp when the item was shared instead of the published date.

How to Install on MAC OS X

  1. Install xmlstartlet. The script has one dependency called xmlstarlet. Xmlstarlet is one of my favorite command line utilities useful for formatting xml and parsing xml files using xslt type processing. Visit this site for directions on how to install.
  2. Download the script. I uploaded the script to my github repository. Download from github and copy the downloaded file into your user directory.  You will need to give execute permission to the script by running:
    chmod 711
  3. Configure the script. You will need to open in your favorite text editor and replace the configuration variables TWITTER_USERNAME and TWITTER_PASSWORD with your twitter username and password.
  4. Find your shared items URL.   Login into Google Reader and find your feed URL.  Copy your feed URL to the clipboard. <div style="display: block; height: 135px;"> </div>

  5. Schedule the script as a cron job. Cron is a time based schedule for unix-like computers such as MAC OS X. Follow the instructions here on installing a new crontab. The row in your crontab file should look similar to this:
    */30 * * * * /Users/ken/

    The ’30′ represents the number of minutes between tweets when you have multiple items in your shared items.</li> </ol>

Important Notes

What Does the Script Do?

The script retrieves the Google Reader RSS shared item feed and filters for new items using the Google timestamp.   The new items are placed in a temporary file.  The script then grabs the oldest item in the temporary file, shortens the URL, tweets the title with the shortened URL, and removes the item upon success.

Possible enhancements include adding sharing to Facebook, using the keychain for passwords, and scheduling your own tweets.

If you have any trouble installing the script or making it run, please let me know.  I would be happy to help you.

Update: I added the capability to use create hashtags for the tweet based on the categories of a given post. This change has been checked in to the git repo.

In Social media, Technology (Google, googlereader, HootSuite - Social Media Dashboard, News aggregator, RSS, Twitter, TwitterFeed)
comments powered by Disqus