summaryrefslogtreecommitdiff
path: root/searx/engines/duckduckgo.py
diff options
context:
space:
mode:
authormarc <a01200356@itesm.mx>2016-10-29 21:04:01 -0500
committermarc <a01200356@itesm.mx>2016-12-13 19:32:43 -0600
commita11948c71bfe7b2aac6e50e7634874d5073c7d84 (patch)
treec5d5c52ca459ba89b2e36d2e87ce3e250be6c896 /searx/engines/duckduckgo.py
parenta11230819ff76312b4528b2bfb6e03d0560075b1 (diff)
downloadsearxng-a11948c71bfe7b2aac6e50e7634874d5073c7d84.tar.gz
searxng-a11948c71bfe7b2aac6e50e7634874d5073c7d84.zip
Add language support for more engines.
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r--searx/engines/duckduckgo.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index a1cb5882c..3e1752dd0 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -16,7 +16,6 @@
from urllib import urlencode
from lxml.html import fromstring
from searx.engines.xpath import extract_text
-from searx.languages import language_codes
# engine dependent config
categories = ['general']
@@ -76,26 +75,7 @@ def request(query, params):
else:
# tries to get a country code from language
locale = locale[0].lower()
- lang_codes = [x[0] for x in language_codes]
- for lc in lang_codes:
- lc = lc.split('-')
- if locale == lc[0] and len(lc) == 2:
- locale = lc[1].lower() + '-' + lc[0].lower()
- break
-
- if locale:
- params['url'] = url.format(
- query=urlencode({'q': query, 'kl': locale}), offset=offset)
- else:
- locale = params['language'].split('-')
- if len(locale) == 2:
- # country code goes first
- locale = locale[1].lower() + '-' + locale[0].lower()
- else:
- # tries to get a country code from language
- locale = locale[0].lower()
- lang_codes = [x[0] for x in language_codes]
- for lc in lang_codes:
+ for lc in supported_languages:
lc = lc.split('-')
if locale == lc[0]:
locale = lc[1].lower() + '-' + lc[0].lower()