Get books: Update amazon.fr and ebooks.com plugins for website changes

Merge branch 'master' of https://github.com/Serized/calibre
This commit is contained in:
Kovid Goyal 2017-06-17 17:49:21 +05:30
commit 22249d1d97
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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 <john@nachtimwald.com>'
@ -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: