diff --git a/src/calibre/gui2/store/stores/amazon_fr_plugin.py b/src/calibre/gui2/store/stores/amazon_fr_plugin.py index 01bc7941b7..59479b70f6 100644 --- a/src/calibre/gui2/store/stores/amazon_fr_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_fr_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 14 # Needed for dynamic plugin loading +store_version = 15 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -68,7 +68,7 @@ def search_amazon(query, max_results=10, timeout=60, cover_xpath = "descendant-or-self::img[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-image ')]/@src" title_xpath = "descendant-or-self::h2[@class and contains(concat(' ', normalize-space(@class), ' '), ' s-access-title ')]//text()" author_xpath = './/span[starts-with(text(), "%s ")]/following-sibling::span//text()' % BY - price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' + price_xpath = 'descendant::span[contains(@class, "s-price")]//text()' else: return diff --git a/src/calibre/gui2/store/stores/ebooks_com_plugin.py b/src/calibre/gui2/store/stores/ebooks_com_plugin.py index 455c705113..170db0a5bd 100644 --- a/src/calibre/gui2/store/stores/ebooks_com_plugin.py +++ b/src/calibre/gui2/store/stores/ebooks_com_plugin.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 2 # Needed for dynamic plugin loading +store_version = 3 # Needed for dynamic plugin loading __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' @@ -70,12 +70,18 @@ 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 @@ -89,16 +95,10 @@ class EbookscomStore(BasicStoreConfig, StorePlugin): if not id: return - price = _('Not Available') br = browser() 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: