mirror of https://github.com/searxng/searxng.git
Compare commits
3 Commits
a0aaf1aa5b
...
416af0c191
Author | SHA1 | Date |
---|---|---|
Markus Heiser | 416af0c191 | |
Markus Heiser | 10d3af84b8 | |
Markus Heiser | 3bf3a89fcc |
|
@ -6,7 +6,7 @@ DuckDuckGo Lite
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
import re
|
import re
|
||||||
from urllib.parse import urlencode, quote_plus
|
from urllib.parse import urlencode
|
||||||
import json
|
import json
|
||||||
import babel
|
import babel
|
||||||
import lxml.html
|
import lxml.html
|
||||||
|
@ -263,7 +263,7 @@ def request(query, params):
|
||||||
|
|
||||||
params['url'] = url
|
params['url'] = url
|
||||||
params['method'] = 'POST'
|
params['method'] = 'POST'
|
||||||
params['data']['q'] = quote_plus(query)
|
params['data']['q'] = query
|
||||||
|
|
||||||
# The API is not documented, so we do some reverse engineering and emulate
|
# The API is not documented, so we do some reverse engineering and emulate
|
||||||
# what https://html.duckduckgo.com/html does when you press "next Page" link
|
# what https://html.duckduckgo.com/html does when you press "next Page" link
|
||||||
|
@ -381,7 +381,11 @@ def response(resp):
|
||||||
zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
|
zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
|
||||||
zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip()
|
zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip()
|
||||||
|
|
||||||
if zero_click and "Your IP address is" not in zero_click and "Your user agent:" not in zero_click:
|
if zero_click and (
|
||||||
|
"Your IP address is" not in zero_click
|
||||||
|
and "Your user agent:" not in zero_click
|
||||||
|
and "URL Decoded:" not in zero_click
|
||||||
|
):
|
||||||
current_query = resp.search_params["data"].get("q")
|
current_query = resp.search_params["data"].get("q")
|
||||||
|
|
||||||
results.append(
|
results.append(
|
||||||
|
|
|
@ -32,7 +32,7 @@ search:
|
||||||
# Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "yandex", "mwmbl",
|
# Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "yandex", "mwmbl",
|
||||||
# "seznam", "startpage", "stract", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
|
# "seznam", "startpage", "stract", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
|
||||||
# by default.
|
# by default.
|
||||||
autocomplete: ""
|
autocomplete: "duckduckgo"
|
||||||
# minimun characters to type before autocompleter starts
|
# minimun characters to type before autocompleter starts
|
||||||
autocomplete_min: 4
|
autocomplete_min: 4
|
||||||
# backend for the favicon near URL in search results.
|
# backend for the favicon near URL in search results.
|
||||||
|
|
Loading…
Reference in New Issue