From f46f80dfb049f85091188d6791883fa618fb76d5 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Sun, 30 Aug 2020 12:07:25 +0100 Subject: [PATCH] Fix bug 1893539: ebook.de not allows to search for books. --- src/calibre/gui2/store/stores/libri_de_plugin.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/store/stores/libri_de_plugin.py b/src/calibre/gui2/store/stores/libri_de_plugin.py index 7575260485..d0a5125836 100644 --- a/src/calibre/gui2/store/stores/libri_de_plugin.py +++ b/src/calibre/gui2/store/stores/libri_de_plugin.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -store_version = 5 # Needed for dynamic plugin loading +store_version = 6 # Needed for dynamic plugin loading __license__ = 'GPL 3' __copyright__ = '2011, John Schember ' @@ -52,19 +52,17 @@ class LibreDEStore(BasicStoreConfig, StorePlugin): counter = max_results with closing(br.open(url, timeout=timeout)) as f: doc = html.fromstring(f.read()) - for data in doc.xpath('//div[contains(@class, "articlecontainer")]'): + for data in doc.xpath('//div[@class="articlecontainer"]'): if counter <= 0: break - + id_ = ''.join(data.xpath('.//div[@class="trackArtiId"]/text()')) + if not id_: + continue details = data.xpath('./div[contains(@class, "articleinfobox")]') if not details: continue details = details[0] - id_ = ''.join(details.xpath('./a/@name')).strip() - if not id_: - continue - title = ''.join(details.xpath('./h3[@class="title"]/a/text()')).strip() - + title = ''.join(details.xpath('./div[@class="title"]/a/text()')).strip() author = ''.join(details.xpath('.//div[@class="author"]/text()')).strip() if author.startswith('von'): author = author[4:]