python3 migration
This commit is contained in:
parent
89a24dd1d4
commit
b6faab1573
7 changed files with 12 additions and 12 deletions
|
|
@ -16,7 +16,7 @@ def get_ids(key, value):
|
|||
ids = []
|
||||
if key == 'isbn':
|
||||
url = '%s/servlet/SearchResults?isbn=%s&sts=t' % (base, id)
|
||||
data = read_url(url)
|
||||
data = read_url(url, unicode=True)
|
||||
urls = re.compile('href="(/servlet/BookDetailsPL[^"]+)"').findall(data)
|
||||
if urls:
|
||||
ids.append((key, value))
|
||||
|
|
@ -28,14 +28,14 @@ def lookup(id):
|
|||
logger.debug('lookup %s', id)
|
||||
data = {}
|
||||
url = '%s/servlet/SearchResults?isbn=%s&sts=t' % (base, id)
|
||||
html = read_url(url)
|
||||
html = read_url(url, unicode=True)
|
||||
urls = re.compile('href="(/servlet/BookDetailsPL[^"]+)"').findall(html)
|
||||
keys = {
|
||||
'pubdate': 'date'
|
||||
}
|
||||
if urls:
|
||||
details = '%s%s' % (base, urls[0])
|
||||
html = read_url(details)
|
||||
html = read_url(details, unicode=True)
|
||||
doc = lxml.html.document_fromstring(html)
|
||||
for e in doc.xpath("//*[contains(@id, 'biblio')]"):
|
||||
key = e.attrib['id'].replace('biblio-', '')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue