Fix bug 1893539: ebook.de not allows to search for books.

This commit is contained in:
Charles Haley 2020-08-30 12:07:25 +01:00 committed by Kovid Goyal
parent 0f32b98fd2
commit f46f80dfb0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals 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' __license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>' __copyright__ = '2011, John Schember <john@nachtimwald.com>'
@ -52,19 +52,17 @@ class LibreDEStore(BasicStoreConfig, StorePlugin):
counter = max_results counter = max_results
with closing(br.open(url, timeout=timeout)) as f: with closing(br.open(url, timeout=timeout)) as f:
doc = html.fromstring(f.read()) 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: if counter <= 0:
break break
id_ = ''.join(data.xpath('.//div[@class="trackArtiId"]/text()'))
if not id_:
continue
details = data.xpath('./div[contains(@class, "articleinfobox")]') details = data.xpath('./div[contains(@class, "articleinfobox")]')
if not details: if not details:
continue continue
details = details[0] details = details[0]
id_ = ''.join(details.xpath('./a/@name')).strip() title = ''.join(details.xpath('./div[@class="title"]/a/text()')).strip()
if not id_:
continue
title = ''.join(details.xpath('./h3[@class="title"]/a/text()')).strip()
author = ''.join(details.xpath('.//div[@class="author"]/text()')).strip() author = ''.join(details.xpath('.//div[@class="author"]/text()')).strip()
if author.startswith('von'): if author.startswith('von'):
author = author[4:] author = author[4:]