diff options
author | Adam Tauber <asciimoo@gmail.com> | 2017-01-27 00:18:46 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2017-01-27 00:18:46 +0100 |
commit | 52d108720254368c1ed9f83e7e1b48fec0f7f456 (patch) | |
tree | 2fe2edd961f608f3a0ac94d0b26fc1c41f093bfd /searx/engines | |
parent | 42606f53dd4551109f5941084d24a087bc586aca (diff) | |
download | searxng-52d108720254368c1ed9f83e7e1b48fec0f7f456.tar.gz searxng-52d108720254368c1ed9f83e7e1b48fec0f7f456.zip |
[enh] add result number parsing to google engine
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/google.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py index 0fdf2d4ae..e14e9e702 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): |