Skip to content

Commit

Permalink
greatbritishchefs: handle case where ingredients are in subheaders (#598
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ptoczko committed Sep 5, 2022
1 parent 348abb2 commit 9ecaec3
Show file tree
Hide file tree
Showing 5 changed files with 2,260 additions and 3 deletions.
11 changes: 8 additions & 3 deletions recipe_scrapers/greatbritishchefs.py
Expand Up @@ -49,14 +49,19 @@ def image(self):
return src if image else None

def ingredients(self):
ingredientsOuter = self.soup.find(
ingredientsOuter = self.soup.findAll(
"ul", {"class": "IngredientsList__ListContainer"}
)
ingGroup = []
ingredparts = ingredientsOuter.findAll("li")
ingredparts = []

for subheader in ingredientsOuter:
ingredparts.extend(subheader.findAll("li"))

for i in ingredparts:
x = normalize_string(i.get_text())
ingGroup.append(x)
if x != "": # Some recipes include an empty li
ingGroup.append(x)
return ingGroup

def instructions(self):
Expand Down
File renamed without changes.

0 comments on commit 9ecaec3

Please sign in to comment.