mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Updated price detection
Use price directly from the list of results rather than the details page.
This commit is contained in:
parent
eb45063d83
commit
bb81194fcb
@ -70,12 +70,16 @@ class EbookscomStore(BasicStoreConfig, StorePlugin):
|
||||
if not title or not author:
|
||||
continue
|
||||
|
||||
price = ''.join(data.xpath(
|
||||
'.//span[starts-with(text(), "US$") or starts-with(text(), "€") or starts-with(text(), "CA$") or starts-with(text(), "AU$") or starts-with(text(), "£")]/text()')).strip()
|
||||
|
||||
counter -= 1
|
||||
|
||||
s = SearchResult()
|
||||
s.cover_url = cover_url
|
||||
s.title = title.strip()
|
||||
s.author = author.strip()
|
||||
s.price = price.strip()
|
||||
s.detail_item = '?url=http://www.ebooks.com/cj.asp?IID=' + id.strip() + '&cjsku=' + id.strip()
|
||||
|
||||
yield s
|
||||
@ -94,11 +98,6 @@ class EbookscomStore(BasicStoreConfig, StorePlugin):
|
||||
with closing(br.open(url + id, timeout=timeout)) as nf:
|
||||
pdoc = html.fromstring(nf.read())
|
||||
|
||||
price_l = pdoc.xpath('//div[@class="book-info"]/div[@class="price"]/text()')
|
||||
if price_l:
|
||||
price = price_l[0]
|
||||
search_result.price = price.strip()
|
||||
|
||||
search_result.drm = SearchResult.DRM_UNLOCKED
|
||||
permissions = ' '.join(pdoc.xpath('//div[@class="permissions-items"]//text()'))
|
||||
if 'off' in permissions:
|
||||
|
Loading…
x
Reference in New Issue
Block a user