forked from Ponysearch/Ponysearch
[fix] google engine - suggestion
BTW: google no longer offers *spelling suggestions* Closes: https://github.com/searxng/searxng/issues/442 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
bd285de48a
commit
488ace1da9
2 changed files with 1 additions and 14 deletions
|
@ -138,12 +138,7 @@ content_xpath = './/div[@class="IsZvec"]'
|
||||||
|
|
||||||
# Suggestions are links placed in a *card-section*, we extract only the text
|
# Suggestions are links placed in a *card-section*, we extract only the text
|
||||||
# from the links not the links itself.
|
# from the links not the links itself.
|
||||||
suggestion_xpath = '//div[contains(@class, "card-section")]//a'
|
suggestion_xpath = '//div[contains(@class, "EIaa9b")]//a'
|
||||||
|
|
||||||
# Since google does *auto-correction* on the first query these are not really
|
|
||||||
# *spelling suggestions*, we use them anyway.
|
|
||||||
spelling_suggestion_xpath = '//div[@class="med"]/p/a'
|
|
||||||
|
|
||||||
|
|
||||||
def get_lang_info(params, lang_list, custom_aliases, supported_any_language):
|
def get_lang_info(params, lang_list, custom_aliases, supported_any_language):
|
||||||
"""Composing various language properties for the google engines.
|
"""Composing various language properties for the google engines.
|
||||||
|
@ -322,7 +317,6 @@ def response(resp):
|
||||||
|
|
||||||
# convert the text to dom
|
# convert the text to dom
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.text)
|
||||||
|
|
||||||
# results --> answer
|
# results --> answer
|
||||||
answer_list = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]')
|
answer_list = eval_xpath(dom, '//div[contains(@class, "LGOjhe")]')
|
||||||
if answer_list:
|
if answer_list:
|
||||||
|
@ -379,9 +373,6 @@ def response(resp):
|
||||||
# append suggestion
|
# append suggestion
|
||||||
results.append({'suggestion': extract_text(suggestion)})
|
results.append({'suggestion': extract_text(suggestion)})
|
||||||
|
|
||||||
for correction in eval_xpath_list(dom, spelling_suggestion_xpath):
|
|
||||||
results.append({'correction': extract_text(correction)})
|
|
||||||
|
|
||||||
# return results
|
# return results
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ from searx.engines.google import (
|
||||||
href_xpath,
|
href_xpath,
|
||||||
content_xpath,
|
content_xpath,
|
||||||
suggestion_xpath,
|
suggestion_xpath,
|
||||||
spelling_suggestion_xpath,
|
|
||||||
detect_google_sorry,
|
detect_google_sorry,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -186,7 +185,4 @@ def response(resp):
|
||||||
# append suggestion
|
# append suggestion
|
||||||
results.append({'suggestion': extract_text(suggestion)})
|
results.append({'suggestion': extract_text(suggestion)})
|
||||||
|
|
||||||
for correction in eval_xpath_list(dom, spelling_suggestion_xpath):
|
|
||||||
results.append({'correction': extract_text(correction)})
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Reference in a new issue