summaryrefslogtreecommitdiff
path: root/searx/engines/photon.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-20 10:25:53 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2014-12-20 10:25:53 +0100
commit533e6287aef6697b6a5c10a81cb4041f401e8f48 (patch)
tree2ba7f008494c1524fac0481c32a3285483eb069f /searx/engines/photon.py
parent667f4d5cfc4cb6bc0c2e47f230915d35e63bc3d2 (diff)
downloadsearxng-533e6287aef6697b6a5c10a81cb4041f401e8f48.tar.gz
searxng-533e6287aef6697b6a5c10a81cb4041f401e8f48.zip
[fix] fix language support in photon engine
Diffstat (limited to 'searx/engines/photon.py')
-rw-r--r--searx/engines/photon.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/engines/photon.py b/searx/engines/photon.py
index 03ad2a085..16340d24a 100644
--- a/searx/engines/photon.py
+++ b/searx/engines/photon.py
@@ -23,6 +23,9 @@ base_url = 'https://photon.komoot.de/'
search_string = 'api/?{query}&limit={limit}'
result_base_url = 'https://openstreetmap.org/{osm_type}/{osm_id}'
+# list of supported languages
+allowed_languages = ['de', 'en', 'fr', 'it']
+
# do search-request
def request(query, params):
@@ -31,8 +34,9 @@ def request(query, params):
limit=number_of_results)
if params['language'] != 'all':
- params['url'] = params['url'] +\
- "&lang=" + params['language'].replace('_', '-')
+ language = params['language'].split('_')[0]
+ if language in allowed_languages:
+ params['url'] = params['url'] + "&lang=" + language
# using searx User-Agent
params['headers']['User-Agent'] = searx_useragent()