From e32aae3b83cab2a18fa612e4deff4e431964e08a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 23 Jun 2012 20:16:55 +0530 Subject: [PATCH] Support for amazon's new results page markup --- src/calibre/ebooks/metadata/sources/amazon.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 6764e2f6f7..219a0e02ca 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -687,7 +687,11 @@ class Amazon(Source): return True for div in root.xpath(r'//div[starts-with(@id, "result_")]'): - for a in div.xpath(r'descendant::a[@class="title" and @href]'): + links = div.xpath(r'descendant::a[@class="title" and @href]') + if not links: + # New amazon markup + links = div.xpath('descendant::h3/a[@href]') + for a in links: title = tostring(a, method='text', encoding=unicode) if title_ok(title): matches.append(a.get('href'))