From 77feb0db3a60902200f88f8966fe6fc42f8b17e3 Mon Sep 17 00:00:00 2001 From: Marcus Wolschon Date: Fri, 13 Jan 2023 21:31:49 +0100 Subject: [PATCH] #1552 Import Recipes from Cookidoo --- cookbook/helper/scrapers/cookidoo.py | 6 +++--- requirements.txt | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cookbook/helper/scrapers/cookidoo.py b/cookbook/helper/scrapers/cookidoo.py index 0906465e0..08cdc9072 100644 --- a/cookbook/helper/scrapers/cookidoo.py +++ b/cookbook/helper/scrapers/cookidoo.py @@ -45,16 +45,16 @@ class Cookidoo(AbstractScraper): instructions_gist.append(step_format.format(step_number, schema_item)) step_number = step_number + 1 elif schema_item.get("@type") == "HowToStep": + # steps make up simple recipes or a section of a more complex recipe if schema_item.get("name", False): - # some sites have duplicated name and text properties (1:1) - # others have name same as text but truncated to X chars. - # ignore name in these cases and add the name value only if it's different from the text + # name may be the text in full or truncated if not schema_item.get("text").startswith( schema_item.get("name").rstrip(".") ): instructions_gist.append(step_format.format(step_number, schema_item.get("name"))) instructions_gist.append(step_format.format(step_number, schema_item.get("text"))) elif schema_item.get("@type") == "HowToSection": + # complex recipes are made up of named sections that are made up of steps section_name = schema_item.get("name") or schema_item.get("Name") or _("Instructions") instructions_gist.append(section_format.format(section_name)) step_number = 1 diff --git a/requirements.txt b/requirements.txt index cc565492c..bbd4df7a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,8 +40,9 @@ django-storages==1.13.2 boto3==1.26.41 django-prometheus==2.2.0 django-hCaptcha==0.2.0 -python-ldap==3.4.3 -django-auth-ldap==4.1.0 +#python-ldap==3.4.3 +django-python3-ldap +#django-auth-ldap==4.1.0 pytest-factoryboy==2.5.0 pyppeteer==1.0.2 validators==0.20.0