summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2013-10-14 23:09:13 +0200
committerasciimoo <asciimoo@gmail.com>2013-10-14 23:09:13 +0200
commitae9fb1d7dccf061032b5d4b167086838feb1463d (patch)
tree76cc836e07f9e14fd9f661660ea96bafcf92fa9c /searx/engines/duckduckgo.py
downloadsearxng-ae9fb1d7dccf061032b5d4b167086838feb1463d.tar.gz
searxng-ae9fb1d7dccf061032b5d4b167086838feb1463d.zip
[enh] initial commit
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]