Browse Source

[enh] add instant answers to google engine

Adam Tauber 8 years ago
parent
commit
0d4da30c7f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      searx/engines/google.py

+ 4 - 0
searx/engines/google.py

@@ -217,6 +217,10 @@ def response(resp):
     # convert the text to dom
     # convert the text to dom
     dom = html.fromstring(resp.text)
     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
     # parse results
     for result in dom.xpath(results_xpath):
     for result in dom.xpath(results_xpath):
         try:
         try: