News for hackers. Stuff that matters.
Re:Show HN: An API for scraping recipe web pages by oneeyedpigeon on Tuesday July 18, 2017 @05:29AM (#14795288)
This really seems to be an exercise in 'structuring recipe data' rather than the ins-and-outs of scraping. Seems like a much-needed task; is there anything approaching a 'standard' for recipe data already?

    "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!
Re:Show HN: An API for scraping recipe web pages by mikepurvis on Tuesday July 18, 2017 @10:31AM (#14796781)
I tried to build a little recipe DB along these lines years ago. What I ended up finding is that as I improved in my own food preparation skills, my interest in super-rigid recipes of this form diminished.

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.

Re:Show HN: An API for scraping recipe web pages by canes123456 on Tuesday July 18, 2017 @03:08PM (#14799194)
I agree that the much of the value of recipes is as a source of new techniques and combinations. However, I strongly prefer precise recipes vs vague recipes. A recipe should be reproducible as much as possible. I can choose to make changes or combine another recipe based on my priorities. However, vagueness in a recipe adds randomness on top of your changes. If precision for a single element does not matter or varies unpredictably that should be called out. Precision also helps me understand how different recipes can be combined into something new.

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.

Re:Show HN: An API for scraping recipe web pages by mikepurvis on Tuesday July 18, 2017 @03:18PM (#14799262)
That's fair, and perhaps precision could be part of the structure. The default is "exactly", but there are options for adding according to taste, judgment, mood, whatever, and some way of expressing a suggested range.

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.

Re:Show HN: An API for scraping recipe web pages by canes123456 on Tuesday July 18, 2017 @05:14PM (#14800121)
"That's fair, and perhaps precision could be part of the structure. The default is "exactly", but there are options for adding according to taste, judgment, mood, whatever, and some way of expressing a suggested range."

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.

Re:Show HN: An API for scraping recipe web pages by setr on Wednesday July 19, 2017 @02:39AM (#14802378)
Tbh I can't actually imagine the measurements in a cookbook were ever really intended to be precise, at least in the kind I've seen. Like even 4 cloves of garlic is vague; it'd have to be given in weight, but no one actually reading a recipe would prefer 30g of garlic over 1 clove.

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

Re:Show HN: An API for scraping recipe web pages by drusepth on Wednesday July 19, 2017 @07:08AM (#14803432)
As someone relatively amateur to cooking, this is entirely news to me. Whenever something doesn't turn out right, I just assume I didn't follow the recipe exact enough somewhere along the way, but have no idea where. Outside of "be more precise when baking", I don't know enough to know when I need to follow recipes exactly and/or how much leeway I have for fudging otherwise.

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!

Re:Show HN: An API for scraping recipe web pages by setr on Wednesday July 19, 2017 @07:08PM (#14808777)
just what do you intend to do? Get a recipe that says 2 pounds chicken leg, 30g garlic, 10 sesame seeds and 4.2 cups yogurt; and then sit down and measure everything to these precise requirements? Realize you only have 4.1 cups of yogurt, and start skimming a little meat of the chicken to toss? It'd take you a day just to prepare the ingredient measurements! Drop some yogurt and you're back to the measuring table

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)

Re:Show HN: An API for scraping recipe web pages by drusepth on Thursday July 20, 2017 @08:25AM (#14811832)
Personally, I don't find "losing" (e.g. making food that isn't good) fun at all, but rather a large waste of time. I would love a recipe that details the quantities of everything I need, and -- yes -- I would (and do) measure down other ingredients when I don't have enough of one, because the minor upfront time cost of doing so outweighs the risk of wasting the entire meal if it turns out bad, IMO.

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.

Re:Show HN: An API for scraping recipe web pages by nkrisc on Tuesday July 18, 2017 @12:34PM (#14797881)
I 100% agree with you. Perhaps this kind of structure would be better suited to baking recipes? This sort of precision (amounts, timing, even order of ingredients) can be very important when baking.
Re:Show HN: An API for scraping recipe web pages by mikepurvis on Tuesday July 18, 2017 @03:15PM (#14799246)
Even there, I'm not too sure. I've found bread baking to be shockingly tolerant to variation— as long as I do 1tsp dried yeast per cup of water, and about 1.5 cups of water per loaf, it turns out beautifully. And if there's not enough yeast or it's rising slowly, whatever, just give it another hour to do its thing.

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.

Re:Show HN: An API for scraping recipe web pages by nkrisc on Tuesday July 18, 2017 @06:49PM (#14800677)
I agree with you on bread. You have to go way off the rails to screw up bread. I was thinking more along the lines of sponges or macarons, things that are a lot more sensitive to variation.
Re:Show HN: An API for scraping recipe web pages by solatic on Tuesday July 18, 2017 @01:54PM (#14798623)
> I think treating food preparation as equivalent to a Vagrantfile would really lose something along the way.

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.

Re:Show HN: An API for scraping recipe web pages by zaque1213 on Tuesday July 18, 2017 @11:33AM (#14797330)
Mark Bittman was the second biggest influencer of the way I prepare food. The first was a college roommate, who literally improvised everything he cooked, as far as ingredients and proportions go, and it tasted amazing every time. It opened my eyes to how subjective cooking can be.

I tried Blue Apron once. So boring.

Re:Show HN: An API for scraping recipe web pages by greglindahl on Tuesday July 18, 2017 @02:03PM (#14798682)
Mark Bittman is one of the people behind Purple Carrot.
Re:Show HN: An API for scraping recipe web pages by irrational on Tuesday July 18, 2017 @02:22PM (#14798858)
Cooking is an art form. Baking is a science.
Re:Show HN: An API for scraping recipe web pages by patrickdavey on Tuesday July 18, 2017 @06:19AM (#14795461)
Heh, I once tried to make a DSL to cope with recipes from cookingforengineers.com e.g. their lovely recipe cards [1] . I totally failed to make anything decent!. The combining of multiple steps etc. was just painful!. In the linked site above, that recipe is so straight forward, I'd love to see how it copes with [1] below.

[1] http://www.cookingforengineers.com/recipe/127/Shepherds-Pie-...

Re:Show HN: An API for scraping recipe web pages by mosselman on Tuesday July 18, 2017 @07:06AM (#14795619)
Those cards are genius. They perfectly illustrate what you can do parallel to other things rather than having to re-read and re-interpret the written instructions continuously.
Re:Show HN: An API for scraping recipe web pages by enobrev on Tuesday July 18, 2017 @07:13AM (#14795646)
I'm a fan of his recipe card as well, though I convert it to a standard recipe for sharing with friends who don't see the format in the same light.

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...

Re:Show HN: An API for scraping recipe web pages by mosselman on Tuesday July 18, 2017 @10:41AM (#14796871)
Looks great. I will give a recipe cards like this a try someday with actual cooking. Looking forward to experimenting with the format.
Re:Show HN: An API for scraping recipe web pages by g4k on Tuesday July 18, 2017 @07:19AM (#14795671)
That is actually a great visualization for recipes and cooking instructions.
Re:Show HN: An API for scraping recipe web pages by Freak_NL on Tuesday July 18, 2017 @05:34AM (#14795303)
Whenever I read a recipe online I get this nagging feeling that there should be some widely used open standard for describing recipes that can do all sorts of awesome stuff (like a web crawler such as DuckDuckGo being able to answer "I have a pineapple, cream, and the usual pantry basics, what can I cook?"), but this seems to go directly against the business models of the big recipe sites, so it will not likely see much uptake.
Re:Show HN: An API for scraping recipe web pages by philbarr on Tuesday July 18, 2017 @05:51AM (#14795370)
I thought once about doing a "flavour graph" where people could go on and add what they thought were good flavours to mix together. The more people added the same flavours, the stronger the edges between nodes would get. I'd probably have to separate it somehow by geographic region, as tastes vary, but in the end you should have a good approximation of "what goes with what".
Re:Show HN: An API for scraping recipe web pages by blackskad on Tuesday July 18, 2017 @06:03AM (#14795410)
There's a Belgian startup that matches flavors with a scientific method. https://www.foodpairing.com/en/home
Re:Show HN: An API for scraping recipe web pages by benyami on Tuesday July 18, 2017 @12:34PM (#14797890)
The Flavor Bible is a published book version of what you're describing.
Re:Show HN: An API for scraping recipe web pages by flashman on Tuesday July 18, 2017 @09:44AM (#14796420)
It's not the same as "what foods go together" but here's a "related flavours" graph I did using research on foods with similar flavour compounds: https://twitter.com/flashman/status/878516648394633216
Re:Show HN: An API for scraping recipe web pages by arthurpaul on Tuesday July 18, 2017 @07:24AM (#14795692)
Re:Show HN: An API for scraping recipe web pages by rocannon on Tuesday July 18, 2017 @06:19AM (#14795463)
Re:Show HN: An API for scraping recipe web pages by madamelic on Tuesday July 18, 2017 @12:20PM (#14797749)
Check out PantryPlan: https://pantryplan.io. It does exactly that and not just meal-by-meal but entire menus.

Disclaimer: I made it. :) Let me know your thoughts.

Re:Show HN: An API for scraping recipe web pages by roryisok on Tuesday July 18, 2017 @09:01AM (#14796168)
There are two ingredient / recipe search engines that work like this

Recipepuppy.com

Foodpairing.ninja

Re:Show HN: An API for scraping recipe web pages by lprubin on Tuesday July 18, 2017 @09:47AM (#14796443)
http://www.supercook.com (Enter ingredients, get recipes)
Re:Show HN: An API for scraping recipe web pages by tkp on Tuesday July 18, 2017 @07:08AM (#14795622)
A nice use-case seen on the recipe website "Marmiton" is a widget to ajust ingredients quantity to the target number of eaters.

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-...

Re:Show HN: An API for scraping recipe web pages by germanier on Tuesday July 18, 2017 @08:24AM (#14795922)
This implementation looks better than the ones commonly found on German recipe sites. As soon as you start adjusting they show you "3/8 pinches of salt" or "5/6 eggs".
Re:Show HN: An API for scraping recipe web pages by rojobuffalo on Tuesday July 18, 2017 @10:31AM (#14796779)
This is something I'm working on. I started with a nutrition graph with endpoints for individual foods, units of measure (with mass conversion for volumetric and common units), physical changes (cutting, blending), chemical changes (cooking, fermenting), and nutrient stats.

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.

Re:Show HN: An API for scraping recipe web pages by pdimitar on Tuesday July 18, 2017 @05:51PM (#14800333)
Is your repository public and/or are you willing to share? I am not looking to make this into a business myself but as a guy who is very frustrated that he can't properly organize his diet, I really want to use something like this.

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.

Re:Show HN: An API for scraping recipe web pages by rojobuffalo on Tuesday July 18, 2017 @06:38PM (#14800609)
The plan is to put out an alpha release this month. In the meantime you might check out https://www.eatthismuch.com/.

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.

Re:Show HN: An API for scraping recipe web pages by pdimitar on Wednesday July 19, 2017 @03:30PM (#14807177)
Unfortunately I am way too busy lately and I feel I would only leech and not contribute, so better keep me out for now.

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.

Re:Show HN: An API for scraping recipe web pages by kozhevnikov on Tuesday July 18, 2017 @06:18AM (#14795454)
Back when microformats were all the rage there was h-recipe

http://microformats.org/wiki/hrecipe

Re:Show HN: An API for scraping recipe web pages by ygra on Tuesday July 18, 2017 @05:34AM (#14795306)
What I'm missing the most in this context is for how many people those ingredients actually are. That's necessary if you want to scale the recipe to fewer or more people.
Re:Show HN: An API for scraping recipe web pages by oneeyedpigeon on Tuesday July 18, 2017 @05:42AM (#14795337)
Yes. As someone with limited cooking skills, I don't think it's quite as simple as 'double quantities of everything to serve 4 people instead of 2'; I'm not sure if it's possible to define a simple formula for how different ingredients scale, nor whether that would need to take into account other ingredients, etc. Would be interesting to see quite how 'algorithmic' cooking can get!
Re:Show HN: An API for scraping recipe web pages by Freak_NL on Tuesday July 18, 2017 @05:45AM (#14795348)
> I don't think it's quite as simple as 'double quantities of everything to serve 4 people instead of 2'

It usually is though. Cooking times however don't tend to scale predictably (except for microwaves).

Re:Show HN: An API for scraping recipe web pages by SeanDav on Tuesday July 18, 2017 @06:01AM (#14795402)
> "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.

Re:Show HN: An API for scraping recipe web pages by semi-extrinsic on Tuesday July 18, 2017 @07:00AM (#14795600)
> warming up 2 packs of something seems to use less than double the amount of time for 1

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.

Re:Show HN: An API for scraping recipe web pages by ygra on Tuesday July 18, 2017 @05:51AM (#14795372)
You still have to know that the amounts stated in the recipe are for 4 people to decide »Hm, that may be a bit much to cook for just two«.
Re:Show HN: An API for scraping recipe web pages by blackskad on Tuesday July 18, 2017 @06:18AM (#14795458)
It's kinda weird that it's not included yet. The schema.org spec has a field 'recipeYield' specifically for this purpose and it's present in the meatball example on the site. It should be quite easy for the author to add it.
Re:Show HN: An API for scraping recipe web pages by askvictor on Tuesday July 18, 2017 @06:12AM (#14795429)
Two things that would be so nice would be easy scaling, and unit conversion (even better if that's automatic)
Re:Show HN: An API for scraping recipe web pages by JepZ on Tuesday July 18, 2017 @06:31AM (#14795511)
Well, as surprising as it might sound there seem to be many units in the kitchen which are not so easy to convert. One example: How many milliliters does a table spoon have? Google says 14.7868 (american table spoon). I have read from 6 to 25... I mean the problem is that the people who writes those recipes use different definitions of the same unit. And that is just one example. How should you convert units which are so different between different authors?
Re:Show HN: An API for scraping recipe web pages by Freak_NL on Tuesday July 18, 2017 @08:05AM (#14795819)
1 US customary table spoon (~14.8ml) is conventionally taken as 15ml, a teaspoon as 5ml, a cup as 240ml. That's roughly what you get when you buy a set of measuring spoons/cups as well; some may be a tad smaller (following the US measurements), and some are aligned with these metric values — the difference is mostly negligible.

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?

Re:Show HN: An API for scraping recipe web pages by askvictor on Tuesday July 18, 2017 @06:22PM (#14800519)
I'm Australian, a 'standard' tablespoon is 20ml, but recipes sometimes use 25. Not sure about the rest of the world. It probably doesn't actually matter too much for most recipes; the ones that need that level of accuracy tend to specify weights.
Re:Show HN: An API for scraping recipe web pages by svnv on Tuesday July 18, 2017 @06:43AM (#14795543)
I created http://www.recipastely.com/ to simplify recipe conversion between us and iso units a few years back. It's not perfect but it seems to work fine for me.
Re:Show HN: An API for scraping recipe web pages by mellum on Tuesday July 18, 2017 @07:06AM (#14795621)
For unit conversion to metric, I made a browser plugin: https://github.com/falk-hueffner/metric-cooking It can also convert from volume to mass, e.g. annotate "3/4 cup plus 2 tablespoons packed light-brown sugar" with "[190 g]". It's a bit hacky (basically a giant regexp) but works nicely for me.
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @07:24AM (#14795688)
I made a recipe scraper that doesn't look at the structured (schema) data, but instead "reads" the whole page to detect the recipe. I found that there are too many recipe sites that don't use the schema rules including, of course, recipes from Facebook posts and emails. Users have used it to copy recipes into their recipe boxes from more than 70,000 different websites. There are a lot of different formats out there!
Re:Show HN: An API for scraping recipe web pages by agotterer on Tuesday July 18, 2017 @08:07AM (#14795829)
Can you share a link?
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @08:10AM (#14795842)
Re:Show HN: An API for scraping recipe web pages by pjc50 on Tuesday July 18, 2017 @08:14AM (#14795859)
Nice :) Is there some artefact of the sorting that puts only pizza recipes on the front page?
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @08:27AM (#14795952)
That's funny! I'm not seeing any pizza recipes now. It shows the latest shared recipes that have images. There are trends, though. One person wrote and complained that vegans were taking over the website, but the next day the Community was back to having lots of meat. The app got a bad review in the app store because this person said that Copy Me That was always showing pot recipes!
Re:Show HN: An API for scraping recipe web pages by k3oni on Tuesday July 18, 2017 @12:38PM (#14797936)
Well not sure what it might be, but as the previous poster got pizza all over i'm into salmon apparently, in 2 pages and 95% recipes are all about salmon :)
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @01:04PM (#14798157)
How weird, it IS all salmon! :) The front page can have a bit of a theme if someone quickly copies in a lot of similar recipes, for example, if he/she is looking for the best salmon recipes from around the web. However, the front page is limited to three recipes from any given person's recipe box. The front page might also show several copies of the same recipe if that recipe suddenly becomes very popular. However, then the recipes would all be showing the exact same salmon recipe. But this is lots of different people copying in salmon recipes from lots of different websites! The world has gone bonkers for salmon.

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).

Re:Show HN: An API for scraping recipe web pages by pjc50 on Tuesday July 18, 2017 @02:55PM (#14799102)
Maybe make the front page show a random subset of the top 10% most popular, or something?
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @03:20PM (#14799271)
I do need to look a lot more into the whole Community search aspect of Copy Me That. So many fun things that I want to do :)
Re:Show HN: An API for scraping recipe web pages by Jaruzel on Tuesday July 18, 2017 @06:01AM (#14795400)
There is a standard of sorts, if you trust Google:

https://developers.google.com/search/docs/data-types/recipes

Re:Show HN: An API for scraping recipe web pages by blackskad on Tuesday July 18, 2017 @06:14AM (#14795437)
This standard is not unique to Google. It's part of the Schema.org initiative to add semantics to the web. The full definition is here:

http://schema.org/Recipe

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.

Re:Show HN: An API for scraping recipe web pages by soneil on Tuesday July 18, 2017 @06:41AM (#14795537)
I was surprised to find that bbc.co.uk/food uses the Recipe schema. Made scraping it much easier when there was some talk about canning it a couple of years back.
Re:Show HN: An API for scraping recipe web pages by peteretep on Tuesday July 18, 2017 @06:47AM (#14795552)

    > 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...
Re:Show HN: An API for scraping recipe web pages by pjc50 on Tuesday July 18, 2017 @08:17AM (#14795880)
Note that industrially this already exists - the EPOS company I work for has quite a sophisticated recipe, stock control and re-ordering solution. In that context, one important thing to handle is variations ("no cheese" etc)
Re:Show HN: An API for scraping recipe web pages by lpasselin on Tuesday July 18, 2017 @08:48AM (#14796090)
Yes, this one is the most used http://microformats.org/wiki/h-recipe
Re:Show HN: An API for scraping recipe web pages by coherentpony on Tuesday July 18, 2017 @11:16AM (#14797167)
This is only part of the problem. The second part is the instructions.

It's not clear to me what the best way to present the second part is.

Re:Show HN: An API for scraping recipe web pages by cronin101 on Tuesday July 18, 2017 @07:44AM (#14795755)
I once hacked together some very basic code to try and do this, so that I could answer the question "what can I make with the stuff in my refrigerator".

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]>
    =end
Re:Show HN: An API for scraping recipe web pages by tinebak on Tuesday July 18, 2017 @08:01AM (#14795795)
I'm working on this and finding that it's a lot of work (and code) to identify the actual ingredient. Consider "all-purpose sifted flour." That's the same ingredient as "plain flour." So (so!) many ways to write the same ingredient. I'm getting there, though :)
Re:Show HN: An API for scraping recipe web pages by cronin101 on Thursday July 20, 2017 @06:14AM (#14811222)
I believe this is "easily" solved by using POS tagging. "flour" is the noun so you can throw the rest away?

That was my approach.

Re:Show HN: An API for scraping recipe web pages by simooooo on Tuesday July 18, 2017 @05:34AM (#14795304)
MyFitnessPal has the same issue where the quantity values mixed between different units, but also between volume(cup) vs weight(grams). So its a pain in the neck to know how heavy a cup of pasta is.

I can see the same issue arising with this tool.

Re:Show HN: An API for scraping recipe web pages by Freak_NL on Tuesday July 18, 2017 @05:43AM (#14795341)
For a lot of the basics (flour, sugar, rice, etc.) conversion formulas/tables exist, but I've found that if you use recipes from around the globe, it's much easier to just have measuring utensils for cups/spoons (US cooking volume units) alongside the standard metric volume measures and scales in your kitchen.
Re:Show HN: An API for scraping recipe web pages by Semaphor on Tuesday July 18, 2017 @05:53AM (#14795377)
At least some of MFPs ("verified") raw ingredient don't seem to use those though. 100g of Avocados, for example, can easily have several thousands of kcal according to them.
Re:Show HN: An API for scraping recipe web pages by unwind on Tuesday July 18, 2017 @09:04AM (#14796185)
A cup of pasta doesn't even compute, since the mass of the pasta will depend so much on the exact shape in question.

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. :)

Re:Show HN: An API for scraping recipe web pages by cbcoutinho on Tuesday July 18, 2017 @05:38AM (#14795323)
That's the beauty of 'user-generated content'. You can scan whatever you want, and if it's not in their system you can just put the details in yourself. That includes choosing what a portion is
Re:Show HN: An API for scraping recipe web pages by craptocurrency on Tuesday July 18, 2017 @11:17AM (#14797169)
Long forgotten Microformats is the way to go.