Extract parenthesised notes from food name to extra field

E.g. "fehérborecet (ízlés szerint)" → food="fehérborecet", extra="ízlés szerint"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 16:10:42 +01:00
parent 480984c7c9
commit 4dde7bd8b5
+8
View File
@@ -221,6 +221,14 @@ def _parse_streetkitchen(soup: BeautifulSoup, url: str) -> dict:
# Split "200g" → qty="200", unit="g"
qty, unit = _split_qty_unit(qty_raw)
# Extract parenthesised note from inside food name
# e.g. "fehérborecet (ízlés szerint)" → food="fehérborecet", extra="ízlés szerint"
if not extra:
m = re.match(r"^(.+?)\s*\(([^)]+)\)\s*$", food)
if m:
food = m.group(1).strip()
extra = m.group(2).strip()
ingredients.append({
"quantity": qty,
"unit": unit,