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

Add support for multiple Aldi (North) domains #1352

Merged
merged 7 commits into from
Nov 12, 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 @@ -88,6 +88,8 @@ Scrapers available for:
- `https://aflavorjournal.com/ <https://aflavorjournal.com/>`_
- `https://ah.nl/ <https://ah.nl/>`_
- `https://akispetretzikis.com/ <https://akispetretzikis.com/>`_
- `https://aldi-nord.de/ <https://aldi-nord.de/>`_
- `.es <https://aldi.es/>`__, `.fr <https://aldi.fr/>`__, `.lu <https://aldi.lu/>`__, `.nl <https://aldi.nl/>`__, `.pl <https://aldi.pl/>`__, `.pt <https://aldi.pt/>`__
- `https://aldi-sued.de/ <https://aldi-sued.de/>`_
- `.hu <https://aldi.hu/>`__, `.it <https://aldi.it/>`__
- `https://aldi-suisse.ch <https://aldi-suisse.ch/>`_
Expand Down
8 changes: 8 additions & 0 deletions recipe_scrapers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from .akispetretzikis import AkisPetretzikis
from .albertheijn import AlbertHeijn
from .aldi import Aldi
from .aldinord import AldiNord
from .aldisued import AldiSued
from .aldisuisse import AldiSuisse
from .alexandracooks import AlexandraCooks
Expand Down Expand Up @@ -426,6 +427,13 @@
AkisPetretzikis.host(): AkisPetretzikis,
AlbertHeijn.host(): AlbertHeijn,
Aldi.host(): Aldi,
AldiNord.host(): AldiNord,
AldiNord.host(domain="aldi.es"): AldiNord,
AldiNord.host(domain="aldi.fr"): AldiNord,
AldiNord.host(domain="aldi.lu"): AldiNord,
AldiNord.host(domain="aldi.nl"): AldiNord,
AldiNord.host(domain="aldi.pl"): AldiNord,
AldiNord.host(domain="aldi.pt"): AldiNord,
AldiSued.host(): AldiSued,
AldiSued.host(domain="aldi.hu"): AldiSued,
AldiSued.host(domain="aldi.it"): AldiSued,
Expand Down
24 changes: 24 additions & 0 deletions recipe_scrapers/aldinord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from ._abstract import AbstractScraper
from ._exceptions import StaticValueException


class AldiNord(AbstractScraper):
@classmethod
def host(cls, domain: str = "aldi-nord.de"):
return domain

def author(self):
if author_from_schema := self.schema.author():
return author_from_schema

raise StaticValueException(return_value="ALDI")

def site_name(self):
raise StaticValueException(return_value="ALDI")

def instructions(self):
return (
self.schema.data.get("recipeInstructions", "")
.replace("\xa0", " ")
.replace("\r\n ", "\n")
)
36 changes: 36 additions & 0 deletions tests/test_data/aldi-nord.de/aldinord.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"author": "ALDI",
"canonical_url": "https://www.aldi-nord.de/rezepte/kategorien/desserts/veganer-kaiserschmarrn-mit-gebratenen-zimt-aepfeln.html",
"site_name": "ALDI",
"host": "aldi-nord.de",
"language": "de",
"title": "Veganer Kaiserschmarrn mit gebratenen Zimt-Äpfeln",
"ingredients": [
"150 ml MY VAY Mandeldrink",
"50 ml QUELLBRUNN Mineralwasser Classic mit Kohlensäure",
"1 EL Zitronensaft",
"1 EL BELLASAN Rapsöl",
"100 g BACK FAMILY Weizenmehl Type 405",
"1 EL BACK FAMILY gemahlene Mandeln",
"1 EL DIADEM Raffinade-Zucker",
"8 g BACK FAMILY Backpulver",
"8 g BACK FAMILY Vanillinzucker",
"20 g BACK FAMILY Pudding Vanille-Geschmack",
"1 EL BELLASAN Sonnenblumen-Margarine zum Braten",
"DIADEM Puderzucker",
"1 großer Apfel (oder 2 kleine Äpfel)",
"1 TL Kokosöl",
"Schuss GUT BIO Agavendicksaft",
"½ TL LE GUSTO Zimt",
"½ TL DIADEM Raffinade-Zucker"
],
"instructions_list": [
"Mandeldrink, Sprudelwasser, Zitronensaft und Öl verrühren. In einer Rührschüssel Mehl, Mandeln, Zucker, Backpulver, Vanillinzucker und Puddingpulver vermischen. Flüssige Zutaten hineingießen und nur kurz zu einem Teig verrühren. Dann 10 Minuten ruhen lassen.",
"Margarine in einer Pfanne schmelzen. Teig in die Pfanne gießen und bei geschlossenem Deckel und mittlerer Hitze etwa 8 Minuten braten.",
"Teig vierteln, wenden und weitere 5 Minuten bei geschlossenem Deckel braten. Danach vorsichtig zerrupfen. ",
"Äpfel schälen, entkernen und kleinschneiden. Kokosöl in einer Pfanne schmelzen. Apfelstückchen in die Pfanne geben und mit einem Schuss Agavendicksaft und Zimt-Zucker einige Minuten bei mittlerer Hitze anbraten, bis der Apfel weich und karamellisiert ist. Gebratenen Apfel zum Kaiserschmarrn geben und alles mit Puderzucker bestäuben. "
],
"yields": "2 servings",
"total_time": 35,
"image": "https://www.aldi-nord.de/content/dam/aldi/germany/rezepte/2024/ato/kw45/AN_Rezepte_KW49_Kaiserschmarrn_Stage_3840x1200.jpg/_jcr_content/renditions/original.transform/1817w/img.241101.jpg"
}
Loading
Loading