FeedFlare for Feed Circulation

UPDATE: Please refer to this version instead, which is updated and ready for use!


I guess it is a small world after all. A while ago I created a FeedFlare to make it easier to post your articles to digg. Wouldn’t you know it, I’m surfing the web a few days ago, minding my own business, and I see that not only is someone else actually using this FeedFlare, but posting the item to digg caused a huge traffic spike to his web site! As John ‘Hannibal’ Smith used to say, “I love it when a plan comes together.”

So, I was inspired to create another FeedFlare: Feed Circulation. If you’re lucky enough to get your item on the digg home page, this is an easy way to watch your numbers go through the roof. đŸ˜‰

This FeedFlare is dynamic (meaning there’s actual code that makes it work) and uses FeedBurner’s Awareness API. So, before you use it, you’ll need to enable Awareness API access to your feed.

How can I use this for myself?

  1. Download and install this Rails app on your web host.
  2. Create a FeedFlare XML file to point to the app and include the relevant URLs, as in
    http://YOUR_DOMAIN/feedcirculation/↵
    circ?feedUrl=YOUR_FULL_FEED_URL_HERE
  3. Login to your FeedBurner account.
  4. Go to the Optimize tab.
  5. Click FeedFlare in the left menu.
  6. Copy/paste the XML file’s URL into the text box under Personal Flare and click Add New Flare.
  7. Scroll down to the bottom and click Save. (This is easy to forget.)

This doesn’t seem to work for me.

I tried to keep this pretty simple to avoid any problems, but, hey…stuff happens. To that end, I wrote this in such way that you can “debug” this a little with any web browser. If you’re having issues, hit this URL:

http://YOUR_DOMAIN/feedcirculation/↵
circ?feedUrl=YOUR_FULL_FEED_URL_HERE

(Make sure to include the full URL.) You might see an error message like the following:

Error occured (1): Feed Not Found

The error code 1 and the message Feed Not Found are returned from FeedBurner and can be looked up on this page. They’re informative, if not exactly verbose, and they should help you pin down what went wrong.

If you see a tiny snippet of XML that tells you how many subscribers you have, you’re good to go.

How does this work?

Three words: Ruby on Rails.

It’s pretty straightforward, really…it grabs your feed URI from the full feedUrl and makes a call to the FeedBurner Awareness API to pull up the number of subscribers. That number is embedded in the XML the code returns, which is then parsed and displayed in your feed or on your site.

To give credit where credit is due, the code to parse the XML returned by FeedBurner was aped from the Ruby wrapper for the Backpack API, written by DHH himself.

Enjoy.

FeedFlare: Printer-Friendly view

I got the itch to do some more coding recently, so I decided to knock out a FeedFlare I had planned on doing for a while: Printer-Friendly view, from on FeedBurner’s list of 101 Flares. What it does is hardly a mystery: it generates a simple, printer-friendly view of a given item in your feed.

How can I use this for myself?

If your blog is powered by Typo, the blogging engine written in Ruby on Rails, this will work for you without modifying the code. Just do the following:

  1. Download and install this Rails app on your web host.
  2. Create a FeedFlare XML file to point to the app and include the relevant URLs, as in
    http://yourserver.com/printerfriendly/display?↵
    feedUrl=YOUR_FULL_FEED_URL_HERE&↵
    itemUrl=YOUR_ITEM_PERMALINK_HERE
  3. Login to your FeedBurner account.
  4. Go to the Optimize tab.
  5. Click FeedFlare in the left menu.
  6. Copy/paste the XML file URL into the text box under Personal Flare and click Add New Flare.
  7. Scroll down to the bottom and click Save. (This is easy to forget.)

If you’re using one of the other blogging engines, you’ll need to download the code and tweak it to account for differences in XML formatting. That being said, if you do plan to run the code on your own, just get in touch with me by posting a comment and I’d be happy to help you change the code to work with your blogging platform.

This doesn’t seem to work for me.

Again, this is probably because the XML format of your blog’s feed is slightly different than the format expected by the code. For example, the output from WordPress has slightly different structure.

You can also try to “debug” this to some extent with your web browser. If you’re having issues, hit this URL:

http://yourserver.com/printerfriendly/display?↵
feedUrl=YOUR_FULL_FEED_URL_HERE&↵
itemUrl=YOUR_ITEM_PERMALINK_HERE

This provides a way to preview what your printer-friendly view will look like outside the context of FeedFlare.

How does this work?

First, it makes an HTTP call to pull down the feed itself, then does some XML parsing to look for the item that matches the permalink. Then, it displays the core item data in a simple web page. Done and done.

So, put another FeedFlare up on the big board. And, please leave comments if you have any.

RSS feed of Backpack Reminders

I thought it might be fun to get my Backpack Reminders syndicated as an RSS feed, for easy sharing outside of a calendar. So, I whipped up a little Rails app to do just that.

How can I use this for myself?

This requires that you have a web hosting account with a provider that supports Ruby on Rails. If you’re in the market for one, I’ve been really happy with my experience at Joyent.

The other thing to watch out for here is security. You don’t want anyone who can guess the URL to be able to read the feed. So, I embedded a security token in the URL that is “unguessable” for all intents and purposes. Also, I avoid storing that token in the source code in clear text by using a standard encryption algorithm.

To use this, the steps are more or less as follows:

  1. Download the Rails app.
  2. Edit the file app/controllers/feed_controller.rb to include your Backpack username and API key.
  3. Choose a security token to be embedded in your feed’s URL. In this example, let’s pretend it’s mytoken.
  4. Generate the SHA-1 hash of your security token. On a Mac, this can be done in Terminal with echo -n mytoken | openssl dgst -sha1. Put this value in the appropriate spot on line 6 of feed_controller.rb.
  5. Change the text blurbs in app/views/feed/rss.rxml to pretty-up the display of the feed.
  6. Upload the Rails app to your web host and test the URL. It should be something like http://myhost.com/reminderfeed/feed?sectoken=mytoken.

How does this work?

The Backpack API makes it a breeze to access your reminders in Ruby, and Rails makes it easy to serve an RSS feed. This is basically the minimum amount of glue need to connect the two. If you’d like more details, the files of interest are app/controllers/feed_controller.rb and app/views/feed/rss.rxml.

If you look at rss.rxml, you’ll notice that I ran into a time zone gotcha because my web host is in a different time zone then my Backpack. If anyone has suggestions on how to improve this, please leave a comment and get in touch.