mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 15:03:36 +02:00
ManyBooks get cover_url
This commit is contained in:
parent
8ccfab537c
commit
5d92612f2e
1 changed files with 10 additions and 1 deletions
|
|
@ -57,10 +57,19 @@ def search(self, query, max_results=10, timeout=60):
|
|||
author = author.split('-')[0]
|
||||
price = '$0.00'
|
||||
|
||||
cover_url = ''
|
||||
with closing(br.open('http://manybooks.net/titles/%s' % id.strip(), timeout=timeout)) as f_i:
|
||||
doc_i = html.fromstring(f_i.read())
|
||||
for img in doc_i.xpath('//img'):
|
||||
src = img.get('src', None)
|
||||
if src and src.endswith('-thumb.jpg'):
|
||||
cover_url = src
|
||||
print cover_url
|
||||
|
||||
counter -= 1
|
||||
|
||||
s = SearchResult()
|
||||
s.cover_url = ''
|
||||
s.cover_url = cover_url
|
||||
s.title = title.strip()
|
||||
s.author = author.strip()
|
||||
s.price = price.strip()
|
||||
|
|
|
|||
Loading…
Reference in a new issue