From 21740522bcc3448a27ac63615e5e4ea082da9a0c Mon Sep 17 00:00:00 2001 From: smilerz Date: Wed, 24 Feb 2021 20:13:06 -0600 Subject: [PATCH] fixed URL import when ingredient is a string --- cookbook/helper/recipe_url_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 139b20ab..3a734d84 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -69,8 +69,10 @@ def find_recipe_json(ld_json, url): if 'recipeIngredient' in ld_json: # some pages have comma separated ingredients in a single array entry if (len(ld_json['recipeIngredient']) == 1 - and len(ld_json['recipeIngredient'][0]) > 30): + and type(ld_json['recipeIngredient']) == list): ld_json['recipeIngredient'] = ld_json['recipeIngredient'][0].split(',') # noqa: E501 + elif type(ld_json['recipeIngredient']) == str: + ld_json['recipeIngredient'] = ld_json['recipeIngredient'].split(',') for x in ld_json['recipeIngredient']: if '\n' in x: