tune worldcat parser

This commit is contained in:
j 2014-08-11 13:27:11 +02:00
parent a8866ca3b3
commit 2d3a0b2247

View file

@ -85,6 +85,13 @@ def lookup(id):
data['publisher'] = publisher data['publisher'] = publisher
data['date'] = date data['date'] = date
data['place'] = [place] data['place'] = [place]
elif ':' in data['publisher']:
place, publisher = data['publisher'].split(':', 2)
data['place'] = place.strip()
data['publisher'] = publisher.split(',')[0].strip()
m = re.compile('\d{4}').findall(publisher)
if m:
data['date'] = m[0]
logger.debug('lookup %s => %s', id, data.keys()) logger.debug('lookup %s => %s', id, data.keys())
return data return data