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

2 requested site additions #1237

Merged
merged 8 commits into from
Sep 9, 2024
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
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ 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>`_
- `https://www.eatingwell.com/ <https://www.eatingwell.com>`_
- `https://www.eatliverun.com/ <https://www.eatliverun.com/>`_
- `https://eatsmarter.com/ <https://eatsmarter.com/>`_
- `.de <https://eatsmarter.de/>`__
- `https://eatthismuch.com/ <https://eatthismuch.com/>`_
- `https://eattolerant.de/ <https://eattolerant.de/>`_
- `https://www.eatwell101.com <https://www.eatwell101.com>`_
- `https://eatwhattonight.com/ <https://eatwhattonight.com/>`_
Expand Down
4 changes: 4 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@
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
from .eatingwell import EatingWell
from .eatliverun import EatLiveRun
from .eatsmarter import Eatsmarter
from .eatthismuch import EatThisMuch
from .eattolerant import EatTolerant
from .eatwell101 import EatWell101
from .eatwhattonight import EatWhatTonight
Expand Down Expand Up @@ -469,7 +471,9 @@
DinnerThenDessert.host(): DinnerThenDessert,
Dishnz.host(): Dishnz,
DobruChutAktualitySK.host(): DobruChutAktualitySK,
DonalSkehan.host(): DonalSkehan,
EatLiveRun.host(): EatLiveRun,
EatThisMuch.host(): EatThisMuch,
ElaVegan.host(): ElaVegan,
EvolvingTable.host(): EvolvingTable,
FamilyfoodOnTheTable.host(): FamilyfoodOnTheTable,
Expand Down
77 changes: 77 additions & 0 deletions recipe_scrapers/donalskehan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from ._abstract import AbstractScraper
from ._exceptions import StaticValueException
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")

def site_name(self):
raise StaticValueException(return_value="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):
recipe_data = self.soup.find_all("li", class_="list-inline-item mb-2")
for element in recipe_data:
if element.find("img", alt="time"):
return get_minutes(element.get_text())

def yields(self):
recipe_data = self.soup.find_all("li", class_="list-inline-item mb-2")
for element in recipe_data:
if "serves" in element.text.lower():
return get_yields(element.text)

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"]
14 changes: 14 additions & 0 deletions recipe_scrapers/eatthismuch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from ._abstract import AbstractScraper
from ._exceptions import StaticValueException


class EatThisMuch(AbstractScraper):
@classmethod
def host(cls):
return "eatthismuch.com"

def site_name(self):
raise StaticValueException(return_value="Eat This Much")

def author(self):
raise StaticValueException(return_value="Eat This Much")
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