From c16f555f1889cc1825d6ff676e36ac8595369f9f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 2 Mar 2017 10:28:58 +0530 Subject: [PATCH] Dont try to get cached URL for directly contrsucted asing based URLs --- src/calibre/ebooks/metadata/sources/amazon.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index c0078c66ba..aa039252c6 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -1247,25 +1247,20 @@ class Amazon(Source): log('User-agent:', br.current_user_agent()) if testing: print('User-agent:', br.current_user_agent()) - if udata is not None: + if udata is not None and not USE_SEARCH_ENGINE: # Try to directly get details page instead of running a search + # Cannot use search engine as the directly constructed URL is + # usually redirected to a full URL by amazon, which is therefore + # not cached domain, idtype, asin, durl = udata - cover_url_processor = None - if USE_SEARCH_ENGINE: - se = search_engines_module() - durl = se.wayback_machine_cached_url( - durl, br, timeout=timeout, log=log) - cover_url_processor = se.wayback_url_processor - if durl is None: - log('Failed to get cached URL for asin:', asin) - else: + if durl is not None: preparsed_root = parse_details_page( durl, log, timeout, br, domain) if preparsed_root is not None: qasin = parse_asin(preparsed_root[1], log, durl) if qasin == asin: w = Worker(durl, result_queue, br, log, 0, domain, - self, testing=testing, preparsed_root=preparsed_root, cover_url_processor=cover_url_processor) + self, testing=testing, preparsed_root=preparsed_root) try: w.get_details() return