diff --git a/mealie/services/scraper/cleaner.py b/mealie/services/scraper/cleaner.py index 7ffeb33a353..c1efabf4a4a 100644 --- a/mealie/services/scraper/cleaner.py +++ b/mealie/services/scraper/cleaner.py @@ -110,11 +110,11 @@ def clean_image(image: str | list | dict | None = None, default: str = "no image case [str(_), *_]: return [x for x in image if x] # Only return non-null strings in list case [{"url": str(_)}, *_]: - return [x["url"] for x in image] + return [x["url"] for x in image if "url" in x] case {"url": str(image)}: return [image] case [{"@id": str(_)}, *_]: - return [x["@id"] for x in image] + return [x["@id"] for x in image if "@id" in x] case _: logger.exception(f"Unexpected type for image: {type(image)}, {image}") return [default] @@ -149,7 +149,7 @@ def clean_instructions(steps_object: list | dict | str, default: list | None = N return [ {"text": _sanitize_instruction_text(instruction["text"])} for instruction in steps_object - if instruction["text"].strip() + if "text" in instruction and instruction["text"].strip() ] case {0: {"text": str()}} | {"0": {"text": str()}} | {1: {"text": str()}} | {"1": {"text": str()}}: # Some recipes have a dict with a string key representing the index, unsure if these can