Creating shopping lists from BBC Recipes using Sinatra
posted by Duncan at 12:44 pm on October 28th, 2009This is another case of looking at a BBC site I use frequently, and extending it. Here’s my use case. I found a recipe I’d like to make from the BBC Recipes site, so I first need to buy the ingredients. The ingredients by default are part of the recipe page, and even if I print out the recipe, it’s still got stuff I don’t need. It would be nice if I could just turn that recipe information into this:
It’s a simple list of ingredients, that have a checkbox next to each item to mark when I have put it in my basket.
So I have built myself a simple Sinatra app that does just this:
If you look at it on your iphone it will look styled, whereas on other devices it will just look simple and standard.
From the site you just need to post the url of a recipe you want the ingredients listed, for example the screenshot above is what happened when I posted this url into it:
It’s very simple, give it a try, see what you think.
Ok, one thing I should note, is that I can’t be sure it will be 100% correct every time. This is a real pain, but out of may hands. The BBC recipe pages look very nice and all, but the most important part of the page “The Recipe” is not only terribly marked up, but it’s not consistent. I suspect this is due to being a free text field in a legacy CMS? but it means that when I get my application to try to look at it, and turn it into a list of ingredients, I can’t be sure of the structure and have to make a bunch of assumptions, which are sometimes wrong.
It would be great if this could be rectified, as we could then see lots of experiments like this out there. In fact with well marked up recipes, and there does appear to be a recipe markup spec:
People could build some great application around all this information.







