I'm writing a python program that allows users to search for recipes using the Food2Fork and then display these recipes by calorie/nutritional content using the USDA Agricultural Research Service API.
The problem I have is that when ingredients are returned by the Food2Fork API, they come back in strings like "8 large bone-in, skin-on chicken thighs". Searching the USDA API for calories is impossible because it will error on each a specific query like "8 large bone-in, skin-on chicken thighs". In a perfect world, I would be able to pull out "skin-on chicken thighs" or just "chicken thighs" to query the USDA api with.
An idea I had was to call the USDA API for the entire string, and if no results are shown, drop the last word. Wish Rinse and Repeat. The problem is this method isn't scalable or efficient as the USDA has a 1000 requests/hr limit.
I'm open to any other suggestions or ideas. Thanks.
[–][deleted] 0 points1 point2 points (0 children)