diff options
author | dalf <alex@al-f.net> | 2014-09-07 22:52:13 +0200 |
---|---|---|
committer | dalf <alex@al-f.net> | 2014-09-07 22:52:13 +0200 |
commit | 64b75e6d829d9fc8b742c94499b5219c12a053d7 (patch) | |
tree | beacf4ebe96877d176103cf8fc868b2c31ab8983 /searx/engines/duckduckgo.py | |
parent | 1e99cf2a0e541a3d2df0104d64fadf955bbccc20 (diff) | |
download | searxng-64b75e6d829d9fc8b742c94499b5219c12a053d7.tar.gz searxng-64b75e6d829d9fc8b742c94499b5219c12a053d7.zip |
[enh] duckduckgo engine: add language support
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r-- | searx/engines/duckduckgo.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index cd7d93c51..296dd9b2d 100644 --- 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 |