From 52d108720254368c1ed9f83e7e1b48fec0f7f456 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Fri, 27 Jan 2017 00:18:46 +0100 Subject: [PATCH] [enh] add result number parsing to google engine --- searx/engines/google.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/searx/engines/google.py b/searx/engines/google.py index 0fdf2d4a..e14e9e70 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -221,6 +221,12 @@ def response(resp): instant_answer = dom.xpath('//div[@id="_vBb"]//text()') if instant_answer: results.append({'answer': u' '.join(instant_answer)}) + try: + results_num = int(dom.xpath('//div[@id="resultStats"]//text()')[0] + .split()[1].replace(',', '')) + results.append({'number_of_results': results_num}) + except: + pass # parse results for result in dom.xpath(results_xpath):