diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index af5590cc53..e8d5c5fc91 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -1538,7 +1538,7 @@ class StoreWaterstonesUKStore(StoreBase): headquarters = 'UK' formats = ['EPUB', 'PDF'] - affiliate = True + affiliate = False class StoreWeightlessBooksStore(StoreBase): name = 'Weightless Books' diff --git a/src/calibre/gui2/store/stores/amazon_de_plugin.py b/src/calibre/gui2/store/stores/amazon_de_plugin.py index c42c7392a1..69e7dcaafc 100644 --- a/src/calibre/gui2/store/stores/amazon_de_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_de_plugin.py @@ -68,9 +68,9 @@ class AmazonDEKindleStore(StorePlugin): cover_url = ''.join(data.xpath(cover_xpath)) title = ''.join(data.xpath('.//a[@class="title"]/text()')) - price = ''.join(data.xpath('.//span[@class="price"]/text()')) + price = ''.join(data.xpath('.//div[@class="newPrice"]/span[contains(@class, "price")]/text()')) - author = ''.join(data.xpath('.//div[@class="title"]/span[@class="ptBrand"]/text()')) + author = ''.join(data.xpath('.//h3[@class="title"]/span[@class="ptBrand"]/text()')) if author.startswith('von '): author = author[4:] diff --git a/src/calibre/gui2/store/stores/amazon_es_plugin.py b/src/calibre/gui2/store/stores/amazon_es_plugin.py index 97abab61ed..094f1e13c9 100644 --- a/src/calibre/gui2/store/stores/amazon_es_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_es_plugin.py @@ -64,8 +64,8 @@ class AmazonESKindleStore(StorePlugin): cover_url = ''.join(data.xpath(cover_xpath)) title = ''.join(data.xpath('.//a[@class="title"]/text()')) - price = ''.join(data.xpath('.//span[@class="price"]/text()')) - author = unicode(''.join(data.xpath('.//div[@class="title"]/span[@class="ptBrand"]/text()'))) + price = ''.join(data.xpath('.//div[@class="newPrice"]/span[contains(@class, "price")]/text()')) + author = unicode(''.join(data.xpath('.//h3[@class="title"]/span[@class="ptBrand"]/text()'))) if author.startswith('de '): author = author[3:] diff --git a/src/calibre/gui2/store/stores/amazon_fr_plugin.py b/src/calibre/gui2/store/stores/amazon_fr_plugin.py index b98ba06117..4e31d69ca5 100644 --- a/src/calibre/gui2/store/stores/amazon_fr_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_fr_plugin.py @@ -65,8 +65,8 @@ class AmazonFRKindleStore(StorePlugin): cover_url = ''.join(data.xpath(cover_xpath)) title = ''.join(data.xpath('.//a[@class="title"]/text()')) - price = ''.join(data.xpath('.//span[@class="price"]/text()')) - author = unicode(''.join(data.xpath('.//div[@class="title"]/span[@class="ptBrand"]/text()'))) + price = ''.join(data.xpath('.//div[@class="newPrice"]/span[contains(@class, "price")]/text()')) + author = unicode(''.join(data.xpath('.//h3[@class="title"]/span[@class="ptBrand"]/text()'))) if author.startswith('de '): author = author[3:] diff --git a/src/calibre/gui2/store/stores/amazon_it_plugin.py b/src/calibre/gui2/store/stores/amazon_it_plugin.py index 23cde51555..39dd1ee0ce 100644 --- a/src/calibre/gui2/store/stores/amazon_it_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_it_plugin.py @@ -64,8 +64,8 @@ class AmazonITKindleStore(StorePlugin): cover_url = ''.join(data.xpath(cover_xpath)) title = ''.join(data.xpath('.//a[@class="title"]/text()')) - price = ''.join(data.xpath('.//span[@class="price"]/text()')) - author = unicode(''.join(data.xpath('.//div[@class="title"]/span[@class="ptBrand"]/text()'))) + price = ''.join(data.xpath('.//div[@class="newPrice"]/span[contains(@class, "price")]/text()')) + author = unicode(''.join(data.xpath('.//h3[@class="title"]/span[@class="ptBrand"]/text()'))) if author.startswith('di '): author = author[3:] diff --git a/src/calibre/gui2/store/stores/amazon_plugin.py b/src/calibre/gui2/store/stores/amazon_plugin.py index 89a6278535..a5912d04ba 100644 --- a/src/calibre/gui2/store/stores/amazon_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_plugin.py @@ -147,7 +147,7 @@ class AmazonKindleStore(StorePlugin): asin_xpath = './/div[@class="image"]/a[1]' cover_xpath = './/img[@class="productImage"]/@src' title_xpath = './/a[@class="title"]/text()' - price_xpath = './/span[@class="price"]/text()' + price_xpath = './/span[contains(@class, "price")]/text()' # Old style list. Search "martin" else: data_xpath = '//div[contains(@class, "result")]' diff --git a/src/calibre/gui2/store/stores/amazon_uk_plugin.py b/src/calibre/gui2/store/stores/amazon_uk_plugin.py index 0d063a4a6e..7fb1cec2d3 100644 --- a/src/calibre/gui2/store/stores/amazon_uk_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_uk_plugin.py @@ -64,9 +64,9 @@ class AmazonUKKindleStore(StorePlugin): cover_url = ''.join(data.xpath(cover_xpath)) title = ''.join(data.xpath('.//a[@class="title"]/text()')) - price = ''.join(data.xpath('.//span[@class="price"]/text()')) + price = ''.join(data.xpath('.//div[@class="newPrice"]/span[contains(@class, "price")]/text()')) - author = ''.join(data.xpath('.//div[@class="title"]/span[@class="ptBrand"]/text()')) + author = ''.join(data.xpath('.//h3[@class="title"]/span[@class="ptBrand"]/text()')) if author.startswith('by '): author = author[3:] diff --git a/src/calibre/gui2/store/stores/bn_plugin.py b/src/calibre/gui2/store/stores/bn_plugin.py index af9168e9ca..ded20e8823 100644 --- a/src/calibre/gui2/store/stores/bn_plugin.py +++ b/src/calibre/gui2/store/stores/bn_plugin.py @@ -7,6 +7,7 @@ __copyright__ = '2011, John Schember ' __docformat__ = 'restructuredtext en' import random +import urllib from contextlib import closing from lxml import html @@ -28,23 +29,27 @@ class BNStore(BasicStoreConfig, StorePlugin): if random.randint(1, 10) in (1, 2, 3): pub_id = '0dsO3kDu/AU' - base_url = 'http://click.linksynergy.com/fs-bin/click?id=%s&subid=&offerid=229293.1&type=10&tmpid=8433&RD_PARM1=' % pub_id - url = base_url + 'http%253A%252F%252Fwww.barnesandnoble.com%252F' + murl = 'http://click.linksynergy.com/fs-bin/click?id=%s&offerid=239662.13&type=3&subid=0' % pub_id if detail_item: - detail_item = base_url + detail_item + purl = 'http://click.linksynergy.com/fs-bin/click?id=%s&subid=&offerid=239662.%s&type=2&subid=0' % (pub_id, detail_item) + url = purl + else: + purl = None + url = murl + + #print(url) if external or self.config.get('open_external', False): - open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url))) + open_url(QUrl(url_slash_cleaner(url))) else: - d = WebStoreDialog(self.gui, url, parent, detail_item) + d = WebStoreDialog(self.gui, murl, parent, purl) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) d.exec_() def search(self, query, max_results=10, timeout=60): - query = query.replace(' ', '-') - url = 'http://www.barnesandnoble.com/s/%s?store=nookstore' % query + url = 'http://www.barnesandnoble.com/s/%s?keyword=%s&store=ebook' % (query.replace(' ', '-'), urllib.quote_plus(query)) br = browser() @@ -55,9 +60,10 @@ class BNStore(BasicStoreConfig, StorePlugin): if counter <= 0: break - id = ''.join(data.xpath('.//a[contains(@class, "thumb")]/@href')) + id = ''.join(data.xpath('.//div[contains(@class, "display-tile-item")]/@data-bn-ean')) if not id: continue + cover_url = ''.join(data.xpath('.//img[contains(@class, "product-image")]/@src')) title = ''.join(data.xpath('.//a[@class="title"]//text()')) diff --git a/src/calibre/gui2/store/stores/ebooks_com_plugin.py b/src/calibre/gui2/store/stores/ebooks_com_plugin.py index 99510005f0..d8bd2ef9fa 100644 --- a/src/calibre/gui2/store/stores/ebooks_com_plugin.py +++ b/src/calibre/gui2/store/stores/ebooks_com_plugin.py @@ -64,11 +64,7 @@ class EbookscomStore(BasicStoreConfig, StorePlugin): continue id = mo.group() - cover_url = '' - cover_load = ''.join(data.xpath('.//div[@class="img"]//img/@onload')) - mo = re.search('(?<=\').+?(?=\')', cover_load) - if mo: - cover_url = mo.group(); + cover_url = ''.join(data.xpath('.//div[@class="img"]//img/@src')) title = '' author = '' diff --git a/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py b/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py index 5db03ab383..804279d3fd 100644 --- a/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py +++ b/src/calibre/gui2/store/stores/ebookshoppe_uk_plugin.py @@ -42,6 +42,7 @@ class EBookShoppeUKStore(BasicStoreConfig, StorePlugin): def search(self, query, max_results=10, timeout=60): url = 'http://www.ebookshoppe.com/search.php?search_query=' + urllib2.quote(query) br = browser() + br.addheaders = [("Referer", "http://www.ebookshoppe.com/")] counter = max_results with closing(br.open(url, timeout=timeout)) as f: diff --git a/src/calibre/gui2/store/stores/foyles_uk_plugin.py b/src/calibre/gui2/store/stores/foyles_uk_plugin.py index c7c236d200..906d47b7ea 100644 --- a/src/calibre/gui2/store/stores/foyles_uk_plugin.py +++ b/src/calibre/gui2/store/stores/foyles_uk_plugin.py @@ -25,16 +25,15 @@ class FoylesUKStore(BasicStoreConfig, StorePlugin): def open(self, parent=None, detail_item=None, external=False): url = 'http://www.awin1.com/awclick.php?mid=1414&id=120917' detail_url = 'http://www.awin1.com/cread.php?awinmid=1414&awinaffid=120917&clickref=&p=' - url_redirect = 'http://www.foyles.co.uk' if external or self.config.get('open_external', False): if detail_item: - url = detail_url + url_redirect + detail_item + url = detail_url + detail_item open_url(QUrl(url_slash_cleaner(url))) else: detail_url = None if detail_item: - detail_url = url + url_redirect + detail_item + detail_url = url + detail_item d = WebStoreDialog(self.gui, url, parent, detail_url) d.setWindowTitle(self.name) d.set_tags(self.config.get('tags', '')) diff --git a/src/calibre/gui2/store/stores/libri_de_plugin.py b/src/calibre/gui2/store/stores/libri_de_plugin.py index a83353523e..643cac3d99 100644 --- a/src/calibre/gui2/store/stores/libri_de_plugin.py +++ b/src/calibre/gui2/store/stores/libri_de_plugin.py @@ -59,7 +59,7 @@ class LibreDEStore(BasicStoreConfig, StorePlugin): id = ''.join(details.xpath('./div[@class="text"]/a/@name')).strip() if not id: continue - cover_url = ''.join(details.xpath('./div[@class="bild"]/a/img/@src')) + cover_url = ''.join(details.xpath('.//div[@class="coverImg"]/a/img/@src')) title = ''.join(details.xpath('./div[@class="text"]/span[@class="titel"]/a/text()')).strip() author = ''.join(details.xpath('./div[@class="text"]/span[@class="author"]/text()')).strip() pdf = details.xpath( @@ -68,7 +68,8 @@ class LibreDEStore(BasicStoreConfig, StorePlugin): 'boolean(.//span[@class="format" and contains(text(), "epub")]/text())') mobi = details.xpath( 'boolean(.//span[@class="format" and contains(text(), "mobipocket")]/text())') - price = (''.join(data.xpath('.//span[@class="preis"]/text()'))).replace('*', '') + price = ''.join(data.xpath('.//span[@class="preis"]/text()')).replace('*', '').strip() + counter -= 1 s = SearchResult() diff --git a/src/calibre/gui2/store/stores/whsmith_uk_plugin.py b/src/calibre/gui2/store/stores/whsmith_uk_plugin.py index 66d81258f7..5d78340517 100644 --- a/src/calibre/gui2/store/stores/whsmith_uk_plugin.py +++ b/src/calibre/gui2/store/stores/whsmith_uk_plugin.py @@ -41,7 +41,7 @@ class WHSmithUKStore(BasicStoreConfig, StorePlugin): def search(self, query, max_results=10, timeout=60): url = ('http://www.whsmith.co.uk/CatalogAndSearch/SearchWithinCategory.aspx' - '?cat=\Books\eb_eBooks&gq=' + urllib2.quote(query)) + '?cat=\eb_eBooks&gq=' + urllib2.quote(query)) br = browser()