diff --git a/searx/engines/translated.py b/searx/engines/translated.py index 2f535140c..3be9d4adf 100644 --- a/searx/engines/translated.py +++ b/searx/engines/translated.py @@ -7,11 +7,12 @@ from searx.languages import language_codes categories = ['general'] url = 'http://api.mymemory.translated.net/get?q={query}' \ - '&langpair={from_lang}|{to_lang}' + '&langpair={from_lang}|{to_lang}{key}' web_url = 'http://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}' weight = 100 parser_re = re.compile(u'.*?([a-z]+)-([a-z]+) (.{2,})$', re.I) +api_key = '' def is_valid_lang(lang): @@ -41,9 +42,14 @@ def request(query, params): if not from_lang or not to_lang: return params + if api_key: + key_form = '&key=' + api_key + else: + key_form = '' params['url'] = url.format(from_lang=from_lang[1], to_lang=to_lang[1], - query=query) + query=query, + key=key_form) params['query'] = query params['from_lang'] = from_lang params['to_lang'] = to_lang diff --git a/searx/settings.yml b/searx/settings.yml index ba5824bb1..63a4b0acf 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -7,7 +7,7 @@ search: autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default server: - port : 8888 + port : 8889 bind_address : "127.0.0.1" # address to listen on secret_key : "ultrasecretkey" # change this! base_url : False # Set custom base_url. Possible values: False or "https://your.custom.host/location/" @@ -503,6 +503,7 @@ engines: engine : translated shortcut : tl timeout : 5.0 + disabled : True # You can use without an API key, but you are limited to 1000 words/day # See : http://mymemory.translated.net/doc/usagelimits.php # api_key : ''