meta
This commit is contained in:
parent
4521f5b14b
commit
5e606b21d8
2 changed files with 8 additions and 6 deletions
|
@ -47,11 +47,13 @@ def lookup(id):
|
||||||
key = e.attrib['id'].replace('bibtip_', '')
|
key = e.attrib['id'].replace('bibtip_', '')
|
||||||
value = e.text_content()
|
value = e.text_content()
|
||||||
data[key] = value
|
data[key] = value
|
||||||
info = doc.xpath('//textarea[@id="util-em-note"]')[0].text
|
info = doc.xpath('//textarea[@id="util-em-note"]')
|
||||||
info = dict([i.split(':', 1) for i in info.split('\n\n')[1].split('\n')])
|
if info:
|
||||||
for key in info:
|
info = info[0].text
|
||||||
k = key.lower()
|
info = dict([i.split(':', 1) for i in info.split('\n\n')[1].split('\n')])
|
||||||
data[k] = info[key].strip()
|
for key in info:
|
||||||
|
k = key.lower()
|
||||||
|
data[k] = info[key].strip()
|
||||||
for key in ('id', 'instance', 'mediatype', 'reclist', 'shorttitle'):
|
for key in ('id', 'instance', 'mediatype', 'reclist', 'shorttitle'):
|
||||||
if key in data:
|
if key in data:
|
||||||
del data[key]
|
del data[key]
|
||||||
|
|
|
@ -16,7 +16,7 @@ def request(action, data):
|
||||||
})
|
})
|
||||||
url = 'http://meta.openmedialibrary.com/api/'
|
url = 'http://meta.openmedialibrary.com/api/'
|
||||||
try:
|
try:
|
||||||
return json.loads(read_url(url, data))['data']
|
return json.loads(read_url(url, data, timeout=60))['data']
|
||||||
except:
|
except:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue