From 57ec6a2b3d41b3e55e308b1c48506801101367ee Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 4 Apr 2022 23:21:13 +0200 Subject: [PATCH] import servings text --- cookbook/helper/recipe_url_import.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index e303989f6..bad57bb73 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -51,12 +51,9 @@ def get_from_scraper(scrape, request): servings = scrape.schema.data.get('recipeYield') or 1 except Exception: servings = 1 - if type(servings) != int: - try: - servings = int(re.findall(r'\b\d+\b', servings)[0]) - except Exception: - servings = 1 - recipe_json['servings'] = max(servings, 1) + + recipe_json['servings'] = parse_servings(servings) + recipe_json['servings_text'] = parse_servings_text(servings) try: recipe_json['working_time'] = get_minutes(scrape.prep_time()) or 0