SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[fix] engine: duckduckgo - only uses first word of the search terms
Nicolas Datoabd9b271bc1c
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.pyindex 3b73d1b6c..a7226043b 100644--- a/searx/engines/duckduckgo.py+++ b/searx/engines/duckduckgo.py@@ -6,7 +6,7 @@ DuckDuckGo Litefrom typing import TYPE_CHECKINGimport re-from urllib.parse import urlencode+from urllib.parse import urlencode, quote_plusimport jsonimport babelimport lxml.html@@ -245,10 +245,12 @@ def request(query, params):# Advanced search syntax ends in CAPTCHA# https://duckduckgo.com/duckduckgo-help-pages/results/syntax/- query = [- x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:")- for x in query.split()- ]+ query = " ".join(+ [+ x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:")+ for x in query.split()+ ]+ )eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)if eng_region == "wt-wt":# https://html.duckduckgo.com/html sets an empty value for "all".@@ -261,7 +263,7 @@ def request(query, params):params['url'] = urlparams['method'] = 'POST'- params['data']['q'] = query+ params['data']['q'] = quote_plus(query)# 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