From 4f86ebee3a5aaa70075857283a2c71ba2ec0c211 Mon Sep 17 00:00:00 2001 From: Noah Hernandez <63211322+oahnh@users.noreply.github.com> Date: Tue, 22 Oct 2024 16:53:35 -0700 Subject: [PATCH] maangchi: fix: use regex string to find ingredients header (#1311) --- recipe_scrapers/maangchi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipe_scrapers/maangchi.py b/recipe_scrapers/maangchi.py index 3656ed1d7..57b557765 100644 --- a/recipe_scrapers/maangchi.py +++ b/recipe_scrapers/maangchi.py @@ -1,3 +1,5 @@ +import re + from ._abstract import AbstractScraper from ._utils import normalize_string @@ -8,7 +10,9 @@ def host(cls): return "maangchi.com" def ingredients(self): - before = self.soup.find("h2", string="Ingredients").find_all_next("li") + before = self.soup.find("h2", string=re.compile(r"Ingredients")).find_all_next( + "li" + ) after = self.soup.find("h2", string="Directions").find_all_previous("li") list_before = [normalize_string(b.get_text()) for b in before] list_after = [normalize_string(a.get_text()) for a in after]