Avoid crash on empty catalog page
This commit is contained in:
parent
fdd8b23118
commit
efa06c9e33
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue