no more authors

This commit is contained in:
j 2015-12-01 10:38:00 +01:00
parent 75164a8399
commit 5f46a68c01

View file

@ -54,12 +54,13 @@ def lookup(id):
'asin': [id] 'asin': [id]
} }
url = '%s/Lookup/Book/%s/%s/1' % (base, id, id) url = '%s/Lookup/Book/%s/%s/1' % (base, id, id)
logger.debug('%s', url)
data = read_url(url).decode('utf-8') data = read_url(url).decode('utf-8')
r["title"] = find_re(data, "<h2>(.*?)</h2>") r["title"] = find_re(data, "<h2>(.*?)</h2>")
if r["title"] == 'Error!': if r["title"] == 'Error!':
return {} return {}
keys = { keys = {
'author': 'Author(s)', #'author': 'Author(s)',
'publisher': 'Publisher', 'publisher': 'Publisher',
'date': 'Publication date', 'date': 'Publication date',
'edition': 'Edition', 'edition': 'Edition',
@ -80,10 +81,12 @@ def lookup(id):
for key in r: for key in r:
if isinstance(r[key], str): if isinstance(r[key], str):
r[key] = decode_html(strip_tags(r[key])).strip() r[key] = decode_html(strip_tags(r[key])).strip()
'''
if 'author' in r and isinstance(r['author'], str) and r['author']: if 'author' in r and isinstance(r['author'], str) and r['author']:
r['author'] = [r['author']] r['author'] = [r['author']]
else: else:
r['author'] = [] r['author'] = []
'''
if r['description'].lower() == 'Description of this item is not available at this time.'.lower(): if r['description'].lower() == 'Description of this item is not available at this time.'.lower():
r['description'] = '' r['description'] = ''
return r return r