From 3e2fb6f814ccc2e3a4e2ee528f41fc059b376034 Mon Sep 17 00:00:00 2001 From: smilerz Date: Fri, 18 Feb 2022 16:31:48 -0600 Subject: [PATCH] Update recipe_url_import.py --- cookbook/helper/recipe_url_import.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 4892f4900..a87f8b7d7 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -378,7 +378,7 @@ def get_minutes(time_text): re.IGNORECASE, ) try: - return int(element) + return int(time_text) except Exception: pass @@ -388,6 +388,10 @@ def get_minutes(time_text): time_text = time_text.split("-", 2)[ 1 ] # sometimes formats are like this: '12-15 minutes' + if " to " in time_text: + time_text = time_text.split("to", 2)[ + 1 + ] # sometimes formats are like this: '12 to 15 minutes' empty = '' for x in time_text: @@ -401,7 +405,7 @@ def get_minutes(time_text): minutes = int(matched.groupdict().get("minutes") or 0) - if "/" in (hours := matched.groupdict().get("hours")): + if "/" in (hours := matched.groupdict().get("hours") or ''): number = hours.split(" ") if len(number) == 2: minutes += 60*int(number[0])