logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 84ff6e289ea608207755b01bc648575a87ea55ba
parent b808a2e26670e06d6f912f7d169a9c59ee7ac8ee
Author: potato <mail@crazypotato.tk>
Date:   Tue,  6 Sep 2016 12:46:18 +0200

[enh] filter non-existing language code/name containing requests

Diffstat:

Msearx/engines/dictionary.py5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/searx/engines/dictionary.py b/searx/engines/dictionary.py @@ -25,6 +25,9 @@ def request(query, params): from_lang = lan[0][1].lower() else: return params + elif from_lang.lower() not in [x[1].lower() for x in language_codes]: + return params + if len(to_lang) == 2: lan = filter(lambda x: x[0][:2] == to_lang, language_codes) @@ -32,6 +35,8 @@ def request(query, params): to_lang = lan[0][1].lower() else: return params + elif to_lang.lower() not in [x[1].lower() for x in language_codes]: + return params params['url'] = url.format(from_lang=from_lang, to_lang=to_lang,query=query) params['from_lang'] = from_lang