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

Fix(maangchi): use regex string to find ingredients header #1311

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from 1 commit
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
6 changes: 5 additions & 1 deletion recipe_scrapers/maangchi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from ._abstract import AbstractScraper
from ._utils import normalize_string

Expand All @@ -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(\s*\(.*\))?")
).find_all_next("li")
jayaddison marked this conversation as resolved.
Show resolved Hide resolved
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]
Expand Down
Loading