Skip to content

Commit

Permalink
1224
Browse files Browse the repository at this point in the history
  • Loading branch information
jknndy committed Sep 1, 2024
1 parent da01bca commit c1f9ce3
Show file tree
Hide file tree
Showing 7 changed files with 1,858 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Scrapers available for:
- `https://dish.co.nz/ <https://dish.co.nz>`_
- `https://dobruchut.aktuality.sk/ <https://dobruchut.aktuality.sk>`_
- `https://domesticate-me.com/ <https://domesticate-me.com/>`_
- `https://donalskehan.com/ <https://donalskehan.com/>`_
- `https://downshiftology.com/ <https://downshiftology.com/>`_
- `https://www.dr.dk/ <https://www.dr.dk/>`_
- `https://www.eatingbirdfood.com/ <https://www.eatingbirdfood.com>`_
Expand Down
2 changes: 2 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
from .dishnz import Dishnz
from .dobruchutaktualitysk import DobruChutAktualitySK
from .domesticateme import DomesticateMe
from .donalskehan import DonalSkehan
from .downshiftology import Downshiftology
from .dr import Dr
from .eatingbirdfood import EatingBirdFood
Expand Down Expand Up @@ -470,6 +471,7 @@
DinnerThenDessert.host(): DinnerThenDessert,
Dishnz.host(): Dishnz,
DobruChutAktualitySK.host(): DobruChutAktualitySK,
DonalSkehan.host(): DonalSkehan,
EatLiveRun.host(): EatLiveRun,
EatThisMuch.host(): EatThisMuch,
ElaVegan.host(): ElaVegan,
Expand Down
79 changes: 79 additions & 0 deletions recipe_scrapers/donalskehan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from ._abstract import AbstractScraper
from ._utils import get_minutes, get_yields


class DonalSkehan(AbstractScraper):
@classmethod
def host(cls):
return "donalskehan.com"

def author(self):
image_element = self.soup.find("img", class_="img-fluid")
return image_element.get("alt") if image_element else "Donal Skehan"

def site_name(self):
return "Donal Skehan"

def title(self):
return self.soup.find("title").get_text()

def category(self):
return self.soup.find("h6", class_="catColour dk-label").get_text()

def total_time(self):
total_time_elements = self.soup.find_all("li", class_="list-inline-item mb-2")
for element in total_time_elements:
if element.find("img", alt="time"):
return get_minutes(element.get_text())
return None

def yields(self):
yields_element = self.soup.find("li", class_="list-inline-item mb-2")
return (
get_yields(yields_element.get_text())
if yields_element and "serves" in yields_element.get_text().lower()
else None
)

def image(self):
image_element = self.soup.find("img", class_="img-fluid shadow")
return image_element["src"]

def ingredients(self):
ingredients_section = self.soup.find(
"div", class_="tab-pane fade show active", id="metric"
)
return [
ingredient.get_text().strip()
for ingredient in ingredients_section.find_all("p")
]

def instructions(self):
instructions_section = self.soup.find(
"div", class_="recipe steps container-fluid"
)
return "\n".join(
step.get_text().strip()
for step in instructions_section.find_all("li", class_="list-group-item")
)

def keywords(self):
keywords_section = self.soup.find("ul", id="tag")
return [
keyword.get_text().strip()
for keyword in keywords_section.find_all(
"li", class_="list-inline-item mb-2"
)
]

def equipment(self):
equipment_section = self.soup.find("div", class_="need")
return [
item.get_text().strip()
for item in equipment_section.find_all("p")
if item.get_text().strip()
]

def description(self):
description_element = self.soup.find("meta", attrs={"name": "description"})
return description_element["content"]
49 changes: 49 additions & 0 deletions tests/test_data/donalskehan.com/donalskehan_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"author": "Donal Skehan",
"canonical_url": "https://donalskehan.com/recipes/gingerbread-pancakes/",
"site_name": "Donal Skehan",
"host": "donalskehan.com",
"language": "en-US",
"title": "Gingerbread Pancakes - Donal Skehan | EAT LIVE GO",
"ingredients": [
"2 tbsp butter, plus extra, melted, for brushing",
"3 tbsp dark brown sugar",
"1 tbsp treacle",
"250g plain flour",
"2 tsp baking powder",
"2 tsp ground ginger",
"2 tsp ground cinnamon",
"½ tsp allspice",
"200ml buttermilk",
"2 large free range eggs",
"1 tsp vanilla bean paste",
"Maple syrup, to serve",
"Creme fraiche, to serve"
],
"instructions_list": [
"1. Add the butter, sugar and treacle to a small pot and place over a medium high heat until the butter has melted and sugar has dissolved.",
"2. In a large mixing bowl combine the flour with the baking powder and spices. Create a well in the centre and pour in the buttermilk, butter/sugar mixture, eggs and vanilla bean paste. Whisk together until a smooth batter forms.",
"3. Brush a large nonstick frying pan with melted butter and place over a medium heat. Add roughly a tablespoon of the batter per pancake across the pan, leaving space for the batter to expand as it cooks. Cook for 2-3 minutes on either side.",
"4. Keep warm in a low oven before serving with maple syrup and dollops of creme fraiche."
],
"category": "breakfast",
"yields": "4 servings",
"description": "have a new recipe this year for Gingerbread Pancakes which are rich with festive spice and sweetened with dark brown sugar and treacle. A welcome addition to your Christmas morning spread served creme fraiche and copious amounts of maple syrup.",
"total_time": 30,
"equipment": [
"Small pot",
"Large mixing bowl",
"Large nonstick frying pan"
],
"image": "https://donalskehan.com/wp-content/uploads/Gingerbread-Pancakes-5-copy-1.jpg",
"keywords": [
"Recipes",
"Winter",
"Breakfast",
"Desserts & Baking",
"Christmas",
"Breakfast",
"pancakes",
"gingerbread"
]
}
Loading

0 comments on commit c1f9ce3

Please sign in to comment.