Skip to content

Commit

Permalink
Fix ingredients for simplyrecipes.com scraper
Browse files Browse the repository at this point in the history
Update the CSS class for ingredients. While here, also update the
formatting of instructions such that colon isn't repeated twice.
Refetch the test HTML file for verification.

Test: python -m coverage run -m unittest tests.test_simplyrecipes
  • Loading branch information
puradox committed Oct 9, 2022
1 parent 516da03 commit ec1c1f7
Show file tree
Hide file tree
Showing 3 changed files with 1,824 additions and 1,480 deletions.
4 changes: 2 additions & 2 deletions recipe_scrapers/simplyrecipes.py
Expand Up @@ -28,7 +28,7 @@ def yields(self):
)

def ingredients(self):
ingredients = self.soup.find("ul", {"class": "ingredient-list"}).findAll("li")
ingredients = self.soup.find("ul", {"class": "structured-ingredients__list"}).findAll("li")

return [normalize_string(ingredient.get_text()) for ingredient in ingredients]

Expand All @@ -40,7 +40,7 @@ def instructions(self):
return "\n".join(
[
normalize_string(
step.div.text + ": " + "".join([p.text for p in step.findAll("p")])
step.div.text + "".join([p.text for p in step.findAll("p")])
)
for step in steps
]
Expand Down

0 comments on commit ec1c1f7

Please sign in to comment.