summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r--searx/engines/duckduckgo.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
new file mode 100644
index 000000000..ed93829ba
--- /dev/null
+++ b/searx/engines/duckduckgo.py
@@ -0,0 +1,14 @@
+from lxml import html
+
+
+def request(query, params):
+ params['method'] = 'POST'
+ params['url'] = 'https://duckduckgo.com/html'
+ params['data']['q'] = query
+ return params
+
+
+def response(resp):
+ dom = html.fromstring(resp.text)
+ results = dom.xpath('//div[@class="results_links results_links_deep web-result"]')
+ return [html.tostring(x) for x in results]