logo

searx

My custom branche(s) on searx, a meta-search engine
commit: d23dd7e276f37a37106d7b6a925d7760c4f0e9b4
parent: 00e5262834801a524b916ad06e515a3b929cfdea
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Mon,  8 Sep 2014 18:32:07 +0200

Merge pull request #94 from dalf/master

[enh] duckduckgo engine: add language support

Diffstat:

Msearx/engines/duckduckgo.py9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py @@ -18,7 +18,7 @@ from searx.utils import html_to_text # engine dependent config categories = ['general'] paging = True -locale = 'us-en' +language_support = True # search-url url = 'https://duckduckgo.com/html?{query}&s={offset}' @@ -34,8 +34,13 @@ content_xpath = './/div[@class="snippet"]//text()' def request(query, params): offset = (params['pageno'] - 1) * 30 + if params['language'] == 'all': + locale = 'en-us' + else: + locale = params['language'].replace('_','-').lower() + params['url'] = url.format( - query=urlencode({'q': query, 'l': locale}), + query=urlencode({'q': query, 'kl': locale}), offset=offset) return params