misc cleanup

This commit is contained in:
smilerz
2021-05-02 20:06:53 -05:00
parent e345d2eb39
commit 984d5aae11
5 changed files with 7 additions and 8 deletions

View File

@@ -14,11 +14,10 @@ from recipe_scrapers._utils import get_minutes
def get_from_scraper(scrape, space):
# converting the scrape_me object to the existing json format based on ld+json
recipe_json = {}
try:
recipe_json['name'] = parse_name(scrape.title() or None)
except (TypeError, AttributeError, ElementNotFoundInHtml, NotImplementedError):
except Exception:
recipe_json['name'] = None
if not recipe_json['name']:
try:
@@ -28,7 +27,7 @@ def get_from_scraper(scrape, space):
try:
description = scrape.schema.data.get("description") or ''
except (AttributeError, ElementNotFoundInHtml, NotImplementedError, SchemaOrgException):
except Exception:
description = ''
recipe_json['description'] = parse_description(description)

View File

@@ -25,9 +25,9 @@ def text_scraper(text, url=None):
class TextScraper(scraper_class):
def __init__(
self,
page_data,
url=None
self,
page_data,
url=None
):
self.wild_mode = False
# self.exception_handling = None # TODO add new method here, old one was deprecated