mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 17:50:29 +00:00
[enh] add instant answers from ddg
This commit is contained in:
parent
6c74bc8908
commit
68365c8c1d
1 changed files with 13 additions and 0 deletions
|
@ -328,6 +328,19 @@ def response(resp):
|
||||||
len_tr_rows = len(tr_rows)
|
len_tr_rows = len(tr_rows)
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
|
zero_click_info_xpath = '//html/body/form/div/table[2]/tr[2]/td/text()'
|
||||||
|
zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip()
|
||||||
|
|
||||||
|
if zero_click:
|
||||||
|
current_query = resp.search_params["data"].get("q")
|
||||||
|
|
||||||
|
results.append(
|
||||||
|
{
|
||||||
|
'answer': zero_click,
|
||||||
|
'url': "https://duckduckgo.com/?" + urlencode({"q": current_query}),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
while len_tr_rows >= offset + 4:
|
while len_tr_rows >= offset + 4:
|
||||||
|
|
||||||
# assemble table rows we need to scrap
|
# assemble table rows we need to scrap
|
||||||
|
|
Loading…
Reference in a new issue