mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixed Gutenberg-store search issue (missing author names)
Collected works may lack the author name field, and its HTML div. This interrupted the search results processing. For example, searching on title or author using "erasmus" yielded no or two results out of 25 max. - Title search now works as expected. - Author search omits discussed results. Apparently at a later stage a match is required between 's.author' and the query.
This commit is contained in:
parent
e5654c1c4f
commit
dfca7b5721
@ -52,7 +52,10 @@ def search(query, max_results=10, timeout=60, write_raw_to=None):
|
||||
a = next(CSSSelect('a.link', li))
|
||||
s.detail_item = absurl(a.get('href'))
|
||||
s.title = etree.tostring(next(CSSSelect('span.title', li)), method='text', encoding='unicode').strip()
|
||||
s.author = etree.tostring(next(CSSSelect('span.subtitle', li)), method='text', encoding='unicode').strip()
|
||||
try:
|
||||
s.author = etree.tostring(next(CSSSelect('span.subtitle', li)), method='text', encoding='unicode').strip()
|
||||
except StopIteration:
|
||||
s.author = ""
|
||||
for img in CSSSelect('img.cover-thumb', li):
|
||||
s.cover_url = absurl(img.get('src'))
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user