Browse Source

[enh] add result number parsing to google engine

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

+ 6
- 0
searx/engines/google.py View File

@@ -221,6 +221,12 @@ def response(resp):
221 221
     instant_answer = dom.xpath('//div[@id="_vBb"]//text()')
222 222
     if instant_answer:
223 223
         results.append({'answer': u' '.join(instant_answer)})
224
+    try:
225
+        results_num = int(dom.xpath('//div[@id="resultStats"]//text()')[0]
226
+                          .split()[1].replace(',', ''))
227
+        results.append({'number_of_results': results_num})
228
+    except:
229
+        pass
224 230
 
225 231
     # parse results
226 232
     for result in dom.xpath(results_xpath):