-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
508 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# mypy: allow-untyped-defs | ||
|
||
from ._abstract import AbstractScraper | ||
from ._utils import get_minutes, get_yields, normalize_string | ||
|
||
|
||
class KeukenLiefdeNL(AbstractScraper): | ||
@classmethod | ||
def host(cls): | ||
return "keukenliefde.nl" | ||
|
||
def author(self): | ||
return self.soup.find("meta", {"name": "author"}).get("content") | ||
|
||
def title(self): | ||
return self.soup.find("meta", {"property": "og:title"}).get("content") | ||
|
||
def category(self): | ||
return self.soup.find( | ||
"div", {"class": "article-meta-item sp gerecht"} | ||
).getText() | ||
|
||
def total_time(self): | ||
return get_minutes( | ||
self.soup.find("div", {"class": "article-meta-item sp tijd"}).getText() | ||
) | ||
|
||
def yields(self): | ||
return get_yields( | ||
self.soup.find("div", {"class": "article-meta-item sp aantal"}).getText() | ||
) | ||
|
||
def image(self): | ||
return self.schema.image() | ||
|
||
def ingredients(self): | ||
ingredients = self.soup.find( | ||
"div", {"id": "clipboard-ingredients"} | ||
).findChildren("li") | ||
|
||
return [normalize_string(i.get_text()) for i in ingredients] | ||
|
||
def instructions(self): | ||
paragraphs = self.soup.find("div", {"class": "preparation"}).findChildren("p") | ||
|
||
instructions = [normalize_string(p.get_text()) for p in paragraphs] | ||
|
||
while "" in instructions: | ||
instructions.remove("") | ||
|
||
return "\n".join(instructions) | ||
|
||
def description(self): | ||
return self.soup.find("meta", {"name": "description"}).get("content") |
Oops, something went wrong.