import servings text

This commit is contained in:
vabene1111
2022-04-04 23:21:13 +02:00
parent 3653d6b911
commit 57ec6a2b3d

View File

@@ -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