forked from zaclys/searxng
[fix] google answers: normalize space of the answers.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
f096d68ec6
commit
05e90f2e57
|
@ -311,9 +311,10 @@ def response(resp):
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
# results --> answer
|
# results --> answer
|
||||||
answer = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]//text()')
|
answer_list = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]')
|
||||||
if answer:
|
if answer_list:
|
||||||
results.append({'answer': ' '.join(answer)})
|
answer_list = [_.xpath("normalize-space()") for _ in answer_list]
|
||||||
|
results.append({'answer': ' '.join(answer_list)})
|
||||||
else:
|
else:
|
||||||
logger.debug("did not find 'answer'")
|
logger.debug("did not find 'answer'")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue