Skip to content

Commit

Permalink
fixed thehappyfoodie ingredient import (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Oct 8, 2022
1 parent ceddab6 commit 578d6e8
Show file tree
Hide file tree
Showing 5 changed files with 2,011 additions and 7 deletions.
18 changes: 11 additions & 7 deletions recipe_scrapers/thehappyfoodie.py
Expand Up @@ -24,19 +24,23 @@ def image(self):
return self.schema.image()

def ingredients(self):
ingredients = self.soup.find(
ingredient_elements = self.soup.find(
"div", {"class": "hf-ingredients__container"}
).findAll("tr")

amount = 0
ingredient_name = 1
ingredients = [
(
ingredient.find_all("td")[amount].get_text(),
ingredient.find_all("td")[ingredient_name].get_text(),
ingredients = []
for e in ingredient_elements:
# Skip elements that look like section headings (for example, 'For the sauce:')
if e.get("class"):
continue
ingredients.append(
(
e.find_all("td")[amount].get_text(),
e.find_all("td")[ingredient_name].get_text(),
)
)
for ingredient in ingredients
]

return [
normalize_string("{} {}".format(amount, name))
Expand Down
File renamed without changes.

0 comments on commit 578d6e8

Please sign in to comment.