Skip to content
Merged
Changes from 4 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
43 changes: 22 additions & 21 deletions recipe_scrapers/donnahay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ class DonnaHay(AbstractScraper):
def host(cls):
return "donnahay.com.au"

def author(self):
return self.schema.author()
Comment thread
Mooree003 marked this conversation as resolved.

def title(self):
return self.schema.title()

def category(self):
return self.schema.category()

def total_time(self):
return self.schema.total_time()
return (
self.soup.find("h1", class_="text-center recipe-title__mobile")
.getText()
.upper()
)

def yields(self):
return self.schema.yields()
div = self.soup.find("div", class_="col-sm-6 method")
return div.find("b").getText()
Comment thread
Mooree003 marked this conversation as resolved.
Outdated

def image(self):
return self.schema.image()
div = self.soup.find("div", class_="image-frame recipes")
if not div:
return
image = div.find("img")
return image["src"]

def ingredients(self):
return self.schema.ingredients()
Expand All @@ -37,15 +37,16 @@ def instructions(self):
for instruction in instructions:
text = instruction.get_text(separator=" ", strip=True)
if "Serves" in text:
text = text.split("Serves", 1)[0].strip() # Remove the sentence starting with Serves
text = text.split("Serves", 1)[
0
].strip() # Remove the sentence starting with Serves
instruction.string = text
return instructions

def ratings(self):
return self.schema.ratings()

def cuisine(self):
return self.schema.cuisine()

def description(self):
return self.schema.description()
def keywords(self):
div = self.soup.find("div", class_="section text-left")
tags = div.find_all("a")
keywords = []
for tag in tags:
keywords.append(tag.getText())
return keywords