From 1cd6aaef70733f87d148f6b764857072dd1b875e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 12 Dec 2024 07:58:10 +0530 Subject: [PATCH] Amazon metadata plugin: Update for changed markup for some books on amazon search results page. Fixes #2091542 [Error in Amazon ebook metadata download](https://bugs.launchpad.net/calibre/+bug/2091542) --- src/calibre/ebooks/metadata/sources/amazon.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 026c933ac4..33a089b369 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -1090,7 +1090,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 3, 10) + version = (1, 3, 11) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon') @@ -1443,9 +1443,10 @@ class Amazon(Source): return True for query in ( - '//div[contains(@class, "s-result-list")]//h2/a[@href]', - '//div[contains(@class, "s-result-list")]//div[@data-index]//h5//a[@href]', - r'//li[starts-with(@id, "result_")]//a[@href and contains(@class, "s-access-detail-page")]', + '//div[contains(@class, "s-result-list")]//h2/a[@href]', + '//div[contains(@class, "s-result-list")]//div[@data-index]//h5//a[@href]', + r'//li[starts-with(@id, "result_")]//a[@href and contains(@class, "s-access-detail-page")]', + '//div[@data-cy="title-recipe"]/a[@href]', ): result_links = root.xpath(query) if result_links: @@ -1812,6 +1813,11 @@ def manual_tests(domain, **kw): # {{{ ] ), + ( # New search results page markup (Dec 2024) + {'title': 'Come si scrive un articolo medico-scientifico'}, + [title_test('Come si scrive un articolo medico-scientifico', exact=True)] + ), + ( # No specific problems {'identifiers': {'isbn': '0743273567'}}, [title_test('the great gatsby'),