mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
fix URL import when recipeYield is a list
This commit is contained in:
@@ -222,6 +222,8 @@ def find_recipe_json(ld_json, url):
|
|||||||
if 'recipeYield' in ld_json:
|
if 'recipeYield' in ld_json:
|
||||||
if type(ld_json['recipeYield']) == str:
|
if type(ld_json['recipeYield']) == str:
|
||||||
ld_json['servings'] = int(re.findall(r'\b\d+\b', ld_json['recipeYield'])[0])
|
ld_json['servings'] = int(re.findall(r'\b\d+\b', ld_json['recipeYield'])[0])
|
||||||
|
elif type(ld_json['recipeYield']) == list:
|
||||||
|
ld_json['servings'] = int(re.findall(r'\b\d+\b', ld_json['recipeYield'][0])[0])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
ld_json['servings'] = 1
|
ld_json['servings'] = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user