diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-06-21 16:46:08 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-06-21 16:50:25 +0200 |
commit | 05e90f2e57043d8ca425e43ed288d45027bdf0ec (patch) | |
tree | 07e577e1f75b51802be7c31179f901813f161a31 /searx/engines | |
parent | f096d68ec6c8ae3efc6656181570791115746d5d (diff) | |
download | searxng-05e90f2e57043d8ca425e43ed288d45027bdf0ec.tar.gz searxng-05e90f2e57043d8ca425e43ed288d45027bdf0ec.zip |
[fix] google answers: normalize space of the answers.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/google.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index 284209523..25adfe4b5 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -311,9 +311,10 @@ def response(resp): dom = html.fromstring(resp.text) # results --> answer - answer = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]//text()') - if answer: - results.append({'answer': ' '.join(answer)}) + answer_list = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]') + if answer_list: + answer_list = [_.xpath("normalize-space()") for _ in answer_list] + results.append({'answer': ' '.join(answer_list)}) else: logger.debug("did not find 'answer'") |