catch error on scrape.image()

This commit is contained in:
smilerz
2021-04-14 19:32:33 -05:00
parent 1e17f3703a
commit b115c37eb8

View File

@ -6,6 +6,7 @@ from isodate.isoerror import ISO8601Error
from cookbook.helper.ingredient_parser import parse as parse_single_ingredient
from cookbook.models import Keyword
from django.utils.dateparse import parse_duration
from recipe_scrapers._schemaorg import SchemaOrgException
from recipe_scrapers._utils import get_minutes, normalize_string
@ -42,9 +43,9 @@ def get_from_scraper(scrape, space):
pass
try:
recipe_json['image'] = scrape.image()
except AttributeError:
pass
recipe_json['image'] = parse_image(scrape.image()) or ''
except (AttributeError, TypeError, SchemaOrgException):
recipe_json['image'] = ''
keywords = []
try: