diff options
author | marc <a01200356@itesm.mx> | 2017-07-04 22:29:06 -0500 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2017-07-10 18:41:50 +0200 |
commit | 405e5c8f24d7e9eee45d830e229570f459e25847 (patch) | |
tree | d315981cf3861a7a5f6dac9c86e786765a5a8604 /searx/engines/duckduckgo.py | |
parent | 38d6ba4066a474c1b13e7ccb6f9ea92b43702a4a (diff) | |
download | searxng-405e5c8f24d7e9eee45d830e229570f459e25847.tar.gz searxng-405e5c8f24d7e9eee45d830e229570f459e25847.zip |
[fix] duckduckgo images doesn't fail with countryless language
Diffstat (limited to 'searx/engines/duckduckgo.py')
-rw-r--r-- | searx/engines/duckduckgo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index 8b6411ca2..ea9242ee4 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -42,7 +42,7 @@ content_xpath = './/a[@class="result__snippet"]' # match query's language to a region code that duckduckgo will accept -def get_region_code(lang): +def get_region_code(lang, lang_list=None): # custom fixes for languages if lang == 'all': region_code = None @@ -66,7 +66,7 @@ def get_region_code(lang): else: # tries to get a country code from language region_code = region_code[0].lower() - for lc in supported_languages: + for lc in (lang_list or supported_languages): lc = lc.split('-') if region_code == lc[0]: region_code = lc[1].lower() + '-' + lc[0].lower() |