summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--searx/engines/google.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py
index d06c0558a..9b976a17b 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -331,11 +331,13 @@ def response(resp):
# results --> 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'")
+ for item in answer_list:
+ results.append(
+ {
+ 'answer': item.xpath("normalize-space()"),
+ 'url': (eval_xpath(item, '../..//a/@href') + [None])[0],
+ }
+ )
# parse results