summaryrefslogtreecommitdiff
path: root/searx/engines/google.py
diff options
context:
space:
mode:
authorDavid A Roberts <d@vidr.cc>2017-01-14 18:40:37 +1000
committerDavid A Roberts <d@vidr.cc>2017-01-16 13:31:16 +1000
commit1d30141c207e51c142cab3eee97783f08c1cb5c9 (patch)
treeb3e07ba1168d274b3b789721270bac20edb30432 /searx/engines/google.py
parentd6cbc6b78be5e97cae8a12fb18ace9d51be5df55 (diff)
downloadsearxng-1d30141c207e51c142cab3eee97783f08c1cb5c9.tar.gz
searxng-1d30141c207e51c142cab3eee97783f08c1cb5c9.zip
[enh] show spelling corrections
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 2fa638d73..0fdf2d4ae 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -112,6 +112,7 @@ title_xpath = './/h3'
content_xpath = './/span[@class="st"]'
content_misc_xpath = './/div[@class="f slp"]'
suggestion_xpath = '//p[@class="_Bmc"]'
+spelling_suggestion_xpath = '//a[@class="spell"]'
# map : detail location
map_address_xpath = './/div[@class="s"]//table//td[2]/span/text()'
@@ -275,6 +276,9 @@ def response(resp):
# append suggestion
results.append({'suggestion': extract_text(suggestion)})
+ for correction in dom.xpath(spelling_suggestion_xpath):
+ results.append({'correction': extract_text(correction)})
+
# return results
return results