Show HN: An API for scraping recipe web pages
choppingboard.recipes
choppingboard.recipes
"ingredients": [
"600g pineapple, peeled, chopped"
]
This seems like a prime candidate for improvement; something like the following would seem to be more useful: "ingredients": [{
"ingredient": "pineapple",
"quantity": {
"value": 600
"unit": "g",
},
"preparation": [ "peeled", "chopped" ]
}]
Using this kind of data, I can imagine automated ordering, management of several planned recipes in conjunction, personalised timing estimations, etc. I think the whole field of cooking is ripe for some quality api-based disruption!Recipepuppy.com
Foodpairing.ninja
Disclaimer: I made it. :) Let me know your thoughts.
I can see the same issue arising with this tool.
You can't substitute a cup of dried tagliatelle (huge "balls of yarn") for a cup of risoni (rice-sized grains of pasta) and be happy after eating that meal. :)
It usually is though. Cooking times however don't tend to scale predictably (except for microwaves).
Not sure I agree. In my very limited experience, I have found that cooking times for microwaves do not scale predictably. For example warming up 2 packs of something seems to use less than double the amount of time for 1. I have had issues in the past of doubling or tripling the cooking time for double/triple the quantity and having food overcooked.
This makes sense. When you see a microwave rated as 750 W, that's assuming there is a sufficient load inside the oven that can absorb all that RF energy. Usually there's not, maybe your food can just absorb 400 W, and when you double the amount of food maybe it can absorb 600 W.
Mainly this is because the outer ~3 cm of food is what absorbs RF energy, heating of the rest of the food is through thermal conduction.
https://developers.google.com/search/docs/data-types/recipes
The biggest problem with it, imho, is the lack of a proper definition of ingredients. An ingredient is just a plain string containing the unit, amount and name and sometimes an extra note. Having a quadruple instead of a string would make this standard a lot more useful.
> I was surprised to find that
> bbc.co.uk/food uses the Recipe
> schema
Gotta say, having worked at the Beeb, this doesn't surprise me at all. Amazing what marginal-value technical itches can be scratched when commercial pressure is eased off...These are quite standardised unless you are using something like Australian tablespoons¹ (but then any American following that recipe would run into problems as well). The US customary cup and spoon measures were introduced exactly to solve the problem of measurement ambiguity in recipes! Nineteenth century cookbooks can be hard to follow because of the significant variation in the interpretation of smidgens, dashes, pinches, and (then) spoons and cups.
1: Are these really a thing? Any Australian care to chime in?
[1] http://www.cookingforengineers.com/recipe/127/Shepherds-Pie-...
Also, a friend and I made enough of his Mac and Cheese[1] to serve 150 people at my wedding a couple years ago. Highly recommended.
1: http://www.cookingforengineers.com/recipe/230/Macaroni-and-C...
You can see it here[1] for example, "Ingrédients / Nombre de personnes", lower in the right column.
[1] http://www.marmiton.org/recettes/recette_courgettes-farcies-...
The front page (Community page) looks different if you're logged in because it updates more often. Maybe I need to re-think the time frame because now the website is stuck on all salmon for two hours for non-logged in users (unless they do a search).
I gave up on the project pretty quickly (now I'm really tempted to pick it up again), but you can definitely get 90% of the way there with 10% of the effort:
ingredients = [
'200g of heavily salted butter',
'six bottles of beer',
'50ml of clotted cream',
'plain brown flour',
'1 oz french cheese',
'8 large eggs',
'2kg of salted pork',
'a pinch of salt',
'a tablespoon of honey'
]
ingredients.map { |i| IngredientParser.parse i }
# => ["butter",
# "beer",
# "clotted cream",
# "flour",
# "cheese",
# "egg",
# "pork",
# "salt",
# "honey"]
https://github.com/cronin101/DataChef/blob/master/utils/ingr... require '../environment.rb'
require '../scrapers/bbc_good_food_scraper.rb'
recipe = Recipe.create source_uri: 'http://www.bbcgoodfood.com/recipes/vietnamese-caramel-trout'
recipe.update_using_scraper BBCGoodFoodScraper
puts recipe.title
puts recipe.description
puts recipe.ingredient_ids.inspect
recipe.ingredient_ids.each { |i| puts((Ingredient.find i).inspect) }
=begin
Vietnamese caramel trout
A caramel base balances out the hot and salty ingredients of this Asian-inspired one-pan fish dish for two
[56, 57, 58, 59, 60, 61, 62, 63, 64]
#<Ingredient id: 56, name: "caster sugar", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 57, name: "thai fish sauce", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 58, name: "red chilli", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 59, name: "ginger", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 60, name: "rainbow trout", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 61, name: "bok choi", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 62, name: "juice lemon", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 63, name: "coriander", recipe_frequency: 1, recipe_ids: [7]>
#<Ingredient id: 64, name: "rice", recipe_frequency: 1, recipe_ids: [7]>
=endThat was my approach.
It's designed as the backend to an NLP interface for describing your recent eating. A food selection composes those endpoints I mentioned; and a recipe is a preset group of food selections. I'm not sure if that's how it should be long-term or how recipe discovery will work, but the goal is an agent that you can talk to about your nutrition intake, food buying, and cooking.
Hell, if it can be improved to be usable enough and to partially replace a personal nutritionist, one might sell access to it one day.
I'm not that experienced with databases; so exposing the design might be unwise from a security perspective. I'm warm to the idea of open sourcing in the future though. I've only shared repo access with a few trusted engineers. If you think you might want to contribute, hmu ryan at terra dot farm.
I have a very keen interest in the area however! What is most interesting for me recently is how exactly is such data represented in computer structures? Since I know that drawing example graphs and giving good examples would swallow huge amounts of time, I asked if the code is open-source so I could reverse-engineer the data model myself and not pester anyone. =)
I fully understand you not wanting to OSS it yet. I'll be extremely interested if you do that one day in the future.
Basically, there's just a lot of slush and room for experimentation in cooking. Think about making a stir fry— how many people would level off exact masses of different vegetables to combine in perfect proportion? Never! You toss in what looks good and that's that. As you gain confidence, this approach spreads out to cover marinades, sauces, salads, breads, baking, etc, etc. You're not looking at recipes because you intend to follow them exactly, but because you're trolling for ideas of new combinations, or new preparation methods, or whatever.
The prose is valuable, because that's where that subtlety is communicated. It's the author saying stuff like: "I know this sounds weird, but do X until Y and then gently add Z and you'll be surprised what a great flavour develops."
Authors like Mark Bittman and Deb Perelman are perfect examples of this. Sure, you might make the odd thing from them exactly as written, but that's not really why you're there. I think treating food preparation as equivalent to a Vagrantfile would really lose something along the way.
I tried Blue Apron once. So boring.
Anyway, that's across white, part whole wheat, part rye, and includes all kinds of additives like bran, wheat germ, cheese, herbs, roasted garlic, even tossing in a pot of leftover porridge from breakfast. Basic bread is almost impossible to screw up.
That's a neat idea, though, in a different direction. If you could implement some kind of standard recipe API and build a business around being a broker for commercial kitchens, wherein a customer inputs a recipe that follows a certain schema and an address, and the commercial kitchens respond saying either "no, we can't make that - we don't have the necessary ingredients / we're cooking at capacity / etc." or "sure, here's how much time it would take and here's how much it would cost." You would lose economies of scale found in most commercial kitchens, but customers would gain much more freedom over what they're ordering compared to pick-from-a-list traditional menus. Users could also search for highly rated recipes from around the world and see if somebody local could make it for them etc.
If you are just giving me a technique or idea then write the article that expresses that. The recipe should be precise but the real value comes from the prose.
The Joy of Cooking's waffle recipe suggests 1/2c butter, but says you can drop that to 1/4c or bump it to 1c depending on how decadently crisp you want the result to be.
Note also that a lot of times the variations are to account for some other inherent variation, like adjusting the sugar in a pie depending on how sweet your fruit is.
Yes, that is ideal. List exactly what you did in your ingredients list. Then add information about what you change and the impact of this. Kenji López-Alt's recipe is the perfect example of this. I prefer starting from the Jacques Torres' recipe but I still go back to Kenji's article. It shows me the impact of moving any of the dials for the cookie I want.
"Note also that a lot of times the variations are to account for some other inherent variation, like adjusting the sugar in a pie depending on how sweet your fruit is."
Yes, but that should be called out.
The key thing is that a recipe should be an actual recipe. It should be precise documentation that allows you to reproduce a product as much as possible. Prose is what actually is teaching you how to cook.
Maybe differs in a restaurant or business, but for home cooking thinking of recipes as precise seems absurd to me. Its 600g... a number that was clearly rounded, and I would bet they eyeballed the amount they wanted and then measured it. Theres too much imprecision in a home kitchen to pretend to be precise
It's actually incredibly frustrating when trying to follow a cook book _because_ they're often so vague. Even things like "4 cloves of garlic" are nerve-wracking because I have no idea how big the average garlic clove is, whether mine is above or below that, how much that matters, in what ways that will affect the taste, how I should accommodate for more/less garlic later, and so on. Garlic's an easy example, but this frustration applies to almost every ingredient -- especially when they're "to taste" or "until brown" (how brown?) or "until ready" and so on.
Give me 600g, give me "stir for 2 seconds", give me detail! If I wanted to go off-book, I wouldn't be using a recipe!
Home cooking is an improvised activity, primarily because its so lenient in what it'll accept. Of course, maybe the french will tell you otherwise, but most food doesn't come with any intent to be 100% reproducible (and it'd be extremely boring if it were), or "designed". They come out leniently tasty, and they look good leniently.
Until brown? Until it looks like a good shade of brown. Until ready? Until it feels like its ready. To taste? Until its tasty.
Its imprecise, because its an ancient activity. You do what seems like a good idea, and don't do it next time if it fails. Its a game where losing is kinda fun (unless you're "designing" food, which I have nothing to say about)
I recognize that some people enjoy the art of cooking, but I personally don't. I cook to make food so I can survive. Perhaps I just haven't found the right cook books for my demographic.
It's not clear to me what the best way to present the second part is.
"prepTime": {
"text": "15 minutes",
"iso": "PT15M",
"minutes": 15
}
Why are you triplicating the time periods? I would limit that to just the ISO 8601 value (PT15M) and let the UI choose the proper rendering of the value.Technically the project is interesting, but if you want to offer a commercial API you might run into copyright and fair use issues (as with any scraping tool). Not so much a problem for personal use, but expect angry letters from the major recipe websites for violating their terms of use (i.e., this is a threat to their business model).
1: Try this link: https://www.thespruce.com/peking-duck-recipe-694920 . You'll see a lot of garbage HTML and XML entities in the JSON that can be filtered and replaced fairly easily.
@brad0 : how did you manage that? Was thespruce.com in your targets?
What are your plans for the project? Will you be open sourcing the code on GitHub?
https://open.blogs.nytimes.com/2015/04/09/extracting-structu...
On scrapers specifically, cinc's recipe importer is decent, but mainly relies on structured meta data.
There's a lot of room to improve these tools though. Lots of complexity and edge cases with recipes :)
Happy to answer questions people have about this stuff.
[1] http://www.chefkoch.de/rezepte/565001154855998/Big-Kahuna-Bu...
example : https://yurielkaim.com/7-green-detox-juice-recipes/
fortunately it doesn't take seven pages to find the actual recipes but I still need to go to each individually and possibly be buried under the ad load. the worst sites spread out the recipes to their own seven pages and still require a link to the site holding the recipe
Is there a behind-the-scenes somewhere? Is this regex magic alone?
There may be ethical questions here, but there shouldn't be any legal concerns (IANAL, just a guy in the process of building a site in this space).