Skip to content

Commit

Permalink
fix: Parser of web recipe return 500 internal server error (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch authored Jan 26, 2024
1 parent 107012d commit f7a446c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/app/controller/recipe/recipe_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,30 +202,30 @@ def scrapeRecipe(args, household_id):
recipe.name = scraper.title()
try:
recipe.time = int(scraper.total_time())
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
try:
recipe.cook_time = int(scraper.cook_time())
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
try:
recipe.prep_time = int(scraper.prep_time())
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
try:
yields = re.search(r"\d*", scraper.yields())
if yields:
recipe.yields = int(yields.group())
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
description = ""
try:
description = scraper.description() + "\n\n"
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
try:
description = description + scraper.instructions()
except (NotImplementedError, ValueError, SchemaOrgException):
except (NotImplementedError, ValueError, AttributeError, SchemaOrgException):
pass
recipe.description = description
recipe.photo = scraper.image()
Expand Down

0 comments on commit f7a446c

Please sign in to comment.