Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed reishunger.de parser #352 #616

Merged
merged 11 commits into from Oct 12, 2022
18 changes: 8 additions & 10 deletions recipe_scrapers/reishunger.py
@@ -1,6 +1,6 @@
# mypy: disallow_untyped_defs=False

from ._abstract import AbstractScraper
from ._utils import normalize_string


class Reishunger(AbstractScraper):
Expand All @@ -27,17 +27,15 @@ def ingredients(self):
return self.schema.ingredients()

def instructions(self):
result = self.soup.find("section", {"class": "recipe-preparation"})
if result:
result = "\n".join(
normalize_string(i.get_text()) for i in result.findAll("p")
)
return result
elements = self.soup.findAll("div", {"class": "flex flex-col"})

# for recipes that do NOT allow to switch between different cooking methods
for e in elements:
if "Zubereitung" in e.get_text():
return e.get_text().replace("\xa0", " ")
jayaddison marked this conversation as resolved.
Show resolved Hide resolved

def ratings(self):
block = self.soup.find("div", {"id": "recipe-header"}).find(
"div", {"class": "nrating"}
)
block = self.soup.find("div", {"class": "nrating"})
if block:
cnt = len(block.findAll("span", {"class": "fa-star"}))
return cnt
Expand Down