From 036cea09d7cadb1a58d059e11c0161a8725fc0ce Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 17 Aug 2012 09:24:51 +0530 Subject: [PATCH] Get Books: Fix clicking of results from Diesel books when there is only a single result not working --- src/calibre/gui2/store/stores/diesel_ebooks_plugin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/store/stores/diesel_ebooks_plugin.py b/src/calibre/gui2/store/stores/diesel_ebooks_plugin.py index 49dcad020c..309ee98e4c 100644 --- a/src/calibre/gui2/store/stores/diesel_ebooks_plugin.py +++ b/src/calibre/gui2/store/stores/diesel_ebooks_plugin.py @@ -34,7 +34,10 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin): detail_url = None if detail_item: - detail_url = detail_item + aff_id + if '?' in detail_item: + detail_url = detail_item + aff_id.replace('?', '&') + else: + detail_url = detail_item + aff_id url = url + aff_id if external or self.config.get('open_external', False): @@ -52,9 +55,11 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin): counter = max_results with closing(br.open(url, timeout=timeout)) as f: + book_url = f.geturl() doc = html.fromstring(f.read()) if doc.xpath('not(boolean(//select[contains(@id, "selection")]))'): + # This is the page for an individual book id = ''.join(doc.xpath('//div[@class="price_fat"]//a/@href')) mo = re.search('(?<=id=).+?(?=&)', id) if not mo: @@ -79,7 +84,7 @@ class DieselEbooksStore(BasicStoreConfig, StorePlugin): s.title = title.strip() s.author = author.strip() s.price = price.strip() - s.detail_item = id.strip() + s.detail_item = book_url s.formats = formats s.drm = drm