1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

[mod] google: support for showing the answer source url

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2023-08-16 08:50:51 +02:00 committed by Markus Heiser
parent 5ec7df3480
commit e2744520f8

View File

@ -331,11 +331,13 @@ def response(resp):
# 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: for item in answer_list:
answer_list = [_.xpath("normalize-space()") for _ in answer_list] results.append(
results.append({'answer': ' '.join(answer_list)}) {
else: 'answer': item.xpath("normalize-space()"),
logger.debug("did not find 'answer'") 'url': (eval_xpath(item, '../..//a/@href') + [None])[0],
}
)
# parse results # parse results