@@ -0,0 +1,32 @@
2+from searx import base_result_template
4+def request(query, params):
5+ params['url'] = 'http://api.duckduckgo.com/?q=%s&format=json&pretty=0' % query
10+ search_res = json.loads(resp.text)
12+ if 'Definition' in search_res:
13+ res = {'title' : search_res.get('Heading', '')
14+ ,'content' : search_res.get('Definition', '')
15+ ,'url' : search_res.get('AbstractURL', '')
17+ results.append(base_result_template.format(**res))
21+#from lxml import html
22+#def request(query, params):
23+# params['method'] = 'POST'
24+# params['url'] = 'https://duckduckgo.com/html'
25+# params['data']['q'] = query
30+# dom = html.fromstring(resp.text)
31+# results = dom.xpath('//div[@class="results_links results_links_deep web-result"]')
32+# return [html.tostring(x) for x in results]