remove html tags from description

This commit is contained in:
smilerz 2021-04-14 10:42:31 -05:00
parent 7524609cd0
commit a531d135b5

View File

@ -21,7 +21,7 @@ def get_from_scraper(scrape, space):
except AttributeError:
description = ''
recipe_json['description'] = normalize_string(description)
recipe_json['description'] = parse_description(description)
try:
servings = scrape.yields()
@ -181,6 +181,14 @@ def parse_ingredients(ingredients):
return ingredients
def parse_description(description):
description = re.sub(r'\n\s*\n', '\n\n', description)
description = re.sub(' +', ' ', description)
description = re.sub('</p>', '\n', description)
description = re.sub('<[^<]+?>', '', description)
return normalize_string(description)
def parse_instructions(instructions):
instruction_text = ''