From ae9fb1d7dccf061032b5d4b167086838feb1463d Mon Sep 17 00:00:00 2001 From: asciimoo Date: Mon, 14 Oct 2013 23:09:13 +0200 Subject: [enh] initial commit --- searx/engines/duckduckgo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 searx/engines/duckduckgo.py (limited to 'searx/engines/duckduckgo.py') 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] -- cgit v1.2.3-54-g00ecf