catch error on scrape.image()
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user