mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-04 03:33:17 +02:00
improved HTML parsing
This commit is contained in:
parent
3d431f2ecf
commit
6a3ad1d22f
1 changed files with 3 additions and 3 deletions
|
|
@ -56,11 +56,11 @@ def search(self, query, max_results=10, timeout=60):
|
|||
|
||||
with closing(br.open(id.strip(), timeout=timeout/4)) as nf:
|
||||
idata = html.fromstring(nf.read())
|
||||
cover_url = ''.join(idata.xpath('//div[@class="boxa"]/div[1]/img/@src'))
|
||||
author = ''.join(idata.xpath('//div[@class="boxb"]/h3[3]/span/text()'))
|
||||
cover_url = ''.join(idata.xpath('//div[@class="boxa"]//div[@class="img"]/img/@src'))
|
||||
author = ''.join(idata.xpath('//div[@class="boxb"]//h3[text()="Autor: "]/span/text()'))
|
||||
title = ''.join(idata.xpath('//div[@class="boxb"]/h2[1]/text()'))
|
||||
title = re.sub(r'\(#.+\)', '', title)
|
||||
formats = ''.join(idata.xpath('//div[@class="boxb"]/h3[6]/span/text()'))
|
||||
formats = ''.join(idata.xpath('//div[@class="boxb"]//h3[text()="Format pliku: "]/span/text()'))
|
||||
price = ''.join(idata.xpath('//div[@class="price-box"]/span/text()')) + ',00 zł'
|
||||
|
||||
counter -= 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue