From 20ba5d597f169ab5b1d3d57b5affbb5c7f516e21 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Mar 2019 09:58:44 +0530 Subject: [PATCH] Fix #1816391 [black-curtain-redirect not work](https://bugs.launchpad.net/calibre/+bug/1816391) --- src/calibre/ebooks/metadata/sources/amazon.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index a8341ccc38..f1f3444827 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -83,9 +83,12 @@ def parse_details_page(url, log, timeout, browser, domain): if domain == 'jp': for a in root.xpath('//a[@href]'): if 'black-curtain-redirect.html' in a.get('href'): - url = 'https://amazon.co.jp' + a.get('href') - log('Black curtain redirect found, following') - return parse_details_page(url, log, timeout, browser, domain) + url = a.get('href') + if url: + if url.startswith('/'): + url = 'https://amazon.co.jp' + a.get('href') + log('Black curtain redirect found, following') + return parse_details_page(url, log, timeout, browser, domain) errmsg = root.xpath('//*[@id="errorMessage"]') if errmsg: @@ -839,7 +842,7 @@ class Worker(Thread): # Get details {{{ class Amazon(Source): name = 'Amazon.com' - version = (1, 2, 4) + version = (1, 2, 5) minimum_calibre_version = (2, 82, 0) description = _('Downloads metadata and covers from Amazon')