parse multiple ingredientGroups

previous version assumed only a single item in a list - this loops through each item
This commit is contained in:
smilerz 2021-04-17 14:12:24 -05:00 committed by GitHub
parent 5869a8ad1b
commit 2f27413c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,9 @@ class CooksIllustrated(AbstractScraper):
def ingredients(self):
if not self.recipe:
self.get_recipe()
ingredients = self.recipe['ingredientGroups'][0]['fields']['recipeIngredientItems']
ingredients = []
for group in self.recipe['ingredientGroups']:
ingredients += group['fields']['recipeIngredientItems']
return [
"{} {} {}{}".format(
i['fields']['qty'] or '',