Skip to content

Commit

Permalink
Add keukenliefde parser
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Sep 30, 2023
1 parent cde9382 commit bed9a85
Show file tree
Hide file tree
Showing 4 changed files with 508 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
from .justbento import JustBento
from .justonecookbook import JustOneCookbook
from .kennymcgovern import KennyMcGovern
from .keukenliefdenl import KeukenLiefdeNL
from .kingarthur import KingArthur
from .kitchenstories import KitchenStories
from .kochbar import Kochbar
Expand Down Expand Up @@ -425,6 +426,7 @@
JustBento.host(): JustBento,
JustOneCookbook.host(): JustOneCookbook,
KennyMcGovern.host(): KennyMcGovern,
KeukenLiefdeNL.host(): KeukenLiefdeNL,
KingArthur.host(): KingArthur,
KitchenStories.host(): KitchenStories,
Kochbar.host(): Kochbar,
Expand Down
54 changes: 54 additions & 0 deletions recipe_scrapers/keukenliefdenl.py
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")
Loading

0 comments on commit bed9a85

Please sign in to comment.