From 687c0b9c053ea507b51d36c86ac82133370e5933 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 7 Mar 2017 10:01:55 +0530 Subject: [PATCH] Get Books; Fix price not being displayed for books from Amazon dues to website changes --- src/calibre/gui2/store/stores/amazon_au_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_ca_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_de_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_es_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_fr_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_in_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_it_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_plugin.py | 4 ++-- src/calibre/gui2/store/stores/amazon_uk_plugin.py | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/calibre/gui2/store/stores/amazon_au_plugin.py b/src/calibre/gui2/store/stores/amazon_au_plugin.py index c1cd2d0e13..a922b6e9e7 100644 --- a/src/calibre/gui2/store/stores/amazon_au_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_au_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 3 # Needed for dynamic plugin loading +store_version = 4 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -66,7 +66,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(), "by ")]/following-sibling::span//text()' - price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_ca_plugin.py b/src/calibre/gui2/store/stores/amazon_ca_plugin.py index 3584e839af..4a1e3d2c8d 100644 --- a/src/calibre/gui2/store/stores/amazon_ca_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_ca_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 5 # Needed for dynamic plugin loading +store_version = 6 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -66,7 +66,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(), "by ")]/following-sibling::span//text()' - price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_de_plugin.py b/src/calibre/gui2/store/stores/amazon_de_plugin.py index 40d717e810..324f0f5572 100644 --- a/src/calibre/gui2/store/stores/amazon_de_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_de_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 13 # Needed for dynamic plugin loading +store_version = 14 # 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 = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_es_plugin.py b/src/calibre/gui2/store/stores/amazon_es_plugin.py index 6e013b2e88..5c19e5f1fe 100644 --- a/src/calibre/gui2/store/stores/amazon_es_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_es_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 13 # Needed for dynamic plugin loading +store_version = 14 # 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 = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_fr_plugin.py b/src/calibre/gui2/store/stores/amazon_fr_plugin.py index e9574cd624..01bc7941b7 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 = 13 # Needed for dynamic plugin loading +store_version = 14 # 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 = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_in_plugin.py b/src/calibre/gui2/store/stores/amazon_in_plugin.py index 953fff080f..a6ee2d24dd 100644 --- a/src/calibre/gui2/store/stores/amazon_in_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_in_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 3 # Needed for dynamic plugin loading +store_version = 4 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -66,7 +66,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(), "by ")]/following-sibling::span//text()' - price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_it_plugin.py b/src/calibre/gui2/store/stores/amazon_it_plugin.py index b99508afba..87e4bf38c3 100644 --- a/src/calibre/gui2/store/stores/amazon_it_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_it_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 13 # Needed for dynamic plugin loading +store_version = 14 # 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 = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return diff --git a/src/calibre/gui2/store/stores/amazon_plugin.py b/src/calibre/gui2/store/stores/amazon_plugin.py index 1032182d9c..b7ce325df4 100644 --- a/src/calibre/gui2/store/stores/amazon_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 13 # Needed for dynamic plugin loading +store_version = 14 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -66,7 +66,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(), "by ")]/following-sibling::span//text()' - price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' elif 'grid' in results.get('class', ''): data_xpath = '//div[contains(@class, "prod")]' format_xpath = ( diff --git a/src/calibre/gui2/store/stores/amazon_uk_plugin.py b/src/calibre/gui2/store/stores/amazon_uk_plugin.py index 184e0a42d6..89a1da9a41 100644 --- a/src/calibre/gui2/store/stores/amazon_uk_plugin.py +++ b/src/calibre/gui2/store/stores/amazon_uk_plugin.py @@ -4,7 +4,7 @@ from __future__ import (unicode_literals, division, absolute_import, print_function) -store_version = 13 # Needed for dynamic plugin loading +store_version = 14 # Needed for dynamic plugin loading from contextlib import closing import urllib @@ -66,7 +66,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(), "by ")]/following-sibling::span//text()' - price_xpath = '(.//span[contains(@class, " s-price ")])[last()]//text()' + price_xpath = 'descendant::span[contains(@class, "sx-price")]/../@aria-label' else: return