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

Fix lecker.de articles #611

Merged
merged 6 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions recipe_scrapers/lecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ def author(self):
return self.schema.author()

def title(self):
return self.schema.title()
try:
return self.schema.title()
except TypeError:
return (
self.soup.find(
"header", {"class": "article-header article-header--article"}
)
.find("h1")
.get_text()
)

def category(self):
return self.schema.category()
Expand All @@ -36,7 +45,13 @@ def ingredients(self):
return self.schema.ingredients()

def instructions(self):
return self.schema.instructions()
if self.schema.instructions():
return self.schema.instructions()
else:
divs = self.soup.find_all("div", {"class": "js-quizToggle"})
for d in divs:
if d.find("span", "article__shifted-jump-label"):
return d.get_text()

def ratings(self):
return self.schema.ratings()
Expand Down
Loading