Fix Project Gutenberg store plugin

This commit is contained in:
Alex Stanev 2011-07-28 12:07:02 +03:00
parent 519ee771b0
commit d592239132

View File

@ -45,7 +45,7 @@ class GutenbergStore(BasicStoreConfig, StorePlugin):
counter = max_results
with closing(br.open(url, timeout=timeout)) as f:
doc = html.fromstring(f.read())
for data in doc.xpath('//ol[@class="results"]//li[contains(@class, "icon_title")]'):
for data in doc.xpath('//ol[@class="results"]//li[@class="entry data icon_title"]'):
if counter <= 0:
break
@ -55,6 +55,9 @@ class GutenbergStore(BasicStoreConfig, StorePlugin):
title = ''.join(data.xpath('.//span[@class="title"]/text()'))
author = ''.join(data.xpath('.//span[@class="subtitle"]/text()'))
if title.lower().find(query.lower()) == -1 and author.lower().find(query.lower()) == -1:
continue
counter -= 1
s = SearchResult()