diff --git a/cookbook/helper/recipe_html_import.py b/cookbook/helper/recipe_html_import.py index bc47d318b..d3a79d4d8 100644 --- a/cookbook/helper/recipe_html_import.py +++ b/cookbook/helper/recipe_html_import.py @@ -88,7 +88,6 @@ def get_recipe_from_source(text, url, space): if 'url' in parse_list[0]: url = parse_list[0]['url'] - # first try finding ld+json as its most common for el in parse_list: @@ -136,7 +135,7 @@ def get_from_html(soup): html.append(s) return html -# todo - look for site info in the soup + def get_images_from_source(soup, url): sources = ['src', 'srcset', 'data-src'] images = [] @@ -165,6 +164,7 @@ def get_images_from_source(soup, url): images.append(u) return images + def remove_graph(el): # recipes type might be wrapped in @graph type if isinstance(el, Tag): @@ -176,4 +176,4 @@ def remove_graph(el): for x in el['@graph']: if '@type' in x and x['@type'] == 'Recipe': el = x - return el \ No newline at end of file + return el diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index 00eb6e7a7..495c22208 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -92,7 +92,7 @@ def find_recipe_json(ld_json, url, space): ld_json['image'] = "" if 'description' in ld_json: - ld_json['description'] = normalize_string(ld_json['description'] ) + ld_json['description'] = normalize_string(ld_json['description']) else: ld_json['description'] = "" @@ -350,6 +350,7 @@ def parse_servings(servings): servings = 1 return servings + def parse_cooktime(cooktime): if type(cooktime) not in [int, float]: try: