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

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

This commit is contained in:
Bnyro 2023-08-08 18:18:28 +02:00 committed by Markus Heiser
parent 6fc2ee514d
commit 64bc98b5fb

View File

@ -237,7 +237,8 @@ def _parse_search(resp):
answer_tag = eval_xpath_getindex(dom, '//div[@class="answer"]', 0, default=None) answer_tag = eval_xpath_getindex(dom, '//div[@class="answer"]', 0, default=None)
if answer_tag: if answer_tag:
result_list.append({'answer': extract_text(answer_tag)}) url = eval_xpath_getindex(dom, '//div[@id="featured_snippet"]/a[@class="result-header"]/@href', 0, default=None)
result_list.append({'answer': extract_text(answer_tag), 'url': url})
# xpath_results = '//div[contains(@class, "snippet fdb") and @data-type="web"]' # xpath_results = '//div[contains(@class, "snippet fdb") and @data-type="web"]'
xpath_results = '//div[contains(@class, "snippet")]' xpath_results = '//div[contains(@class, "snippet")]'