Skip to content

Commit

Permalink
fixed servings blank
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Feb 20, 2021
1 parent b6b505c commit e2b1115
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cookbook/helper/recipe_url_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ def find_recipe_json(ld_json, url):
else:
ld_json['prepTime'] = 0

ld_json['servings'] = 1
try:
if 'recipeYield' in ld_json:
if type(ld_json['recipeYield']) == str:
ld_json['servings'] = int(re.findall(r'\b\d+\b', ld_json['recipeYield'])[0])
except Exception as e:
print(e)
ld_json['servings'] = 1

for key in list(ld_json):
if key not in [
Expand Down

0 comments on commit e2b1115

Please sign in to comment.