import json from typing import Optional, Iterable, List, Tuple, Dict import httpx from bs4 import BeautifulSoup import html as _html # POLICY: Strict ld+json-only recipe extraction # --------------------------------------------- # This scraper MUST NOT perform complex HTML-based ingredient parsing. # Only two things are allowed when parsing HTML: # 1) Discover additional, more-friendly variants of the same page (e.g., amp/print) # 2) Locate and parse