Avoid crash on empty catalog page

This commit is contained in:
Edward Betts 2020-06-30 11:23:15 +01:00
parent fdd8b23118
commit efa06c9e33

View file

@ -154,9 +154,10 @@ def check_catalog(entity, catalog):
return return
html = get_catalog_url(catalog_url) html = get_catalog_url(catalog_url)
if html:
description = get_description_from_page(html) description = get_description_from_page(html)
if description: if description:
catalog['description'] = description, catalog['description'] = description
return return
for property_id in sorted(catalog_ids): for property_id in sorted(catalog_ids):
@ -208,6 +209,8 @@ def get_catalog_from_artwork(entity):
return catalog return catalog
def get_description_from_page(html): def get_description_from_page(html):
if not html:
return
root = lxml.html.fromstring(html) root = lxml.html.fromstring(html)
div = root.find('.//div[@itemprop="description"]') div = root.find('.//div[@itemprop="description"]')
if div is not None: if div is not None: