summaryrefslogtreecommitdiff
path: root/searx/engines/google.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2017-01-05 17:20:12 +0100
committerAdam Tauber <asciimoo@gmail.com>2017-01-05 17:20:12 +0100
commit0d4da30c7f9104224ec96d7adf61747fb761b52b (patch)
tree70aad020af5e219e257d1e2387122d1463b0eae2 /searx/engines/google.py
parentfc14fb0a6735de44ef0590381df261804a4783bc (diff)
downloadsearxng-0d4da30c7f9104224ec96d7adf61747fb761b52b.tar.gz
searxng-0d4da30c7f9104224ec96d7adf61747fb761b52b.zip
[enh] add instant answers to google engine
Diffstat (limited to 'searx/engines/google.py')
-rw-r--r--searx/engines/google.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py
index 803cd307e..2fa638d73 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -217,6 +217,10 @@ def response(resp):
# convert the text to dom
dom = html.fromstring(resp.text)
+ instant_answer = dom.xpath('//div[@id="_vBb"]//text()')
+ if instant_answer:
+ results.append({'answer': u' '.join(instant_answer)})
+
# parse results
for result in dom.xpath(results_xpath):
try: