diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2019-01-06 15:27:46 +0100 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2019-01-07 21:19:00 +0100 |
commit | b63d645a52d663036b97e31a59818d79faa4da81 (patch) | |
tree | 6ba72217200a0f52f82ba8244afbee19c24d098c /searx/engines/yahoo.py | |
parent | 491792c1a58f71083f6af663bb6d93e40fa44c9f (diff) | |
download | searxng-b63d645a52d663036b97e31a59818d79faa4da81.tar.gz searxng-b63d645a52d663036b97e31a59818d79faa4da81.zip |
Revert "remove 'all' option from search languages"
This reverts commit 4d1770398a6af8902e75c0bd885781584d39e796.
Diffstat (limited to 'searx/engines/yahoo.py')
-rw-r--r-- | searx/engines/yahoo.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py index ba4cb6af8..73b78bcf7 100644 --- a/searx/engines/yahoo.py +++ b/searx/engines/yahoo.py @@ -73,16 +73,25 @@ def _get_url(query, offset, language, time_range): lang=language) +def _get_language(params): + if params['language'] == 'all': + return 'en' + + language = match_language(params['language'], supported_languages, language_aliases) + if language not in language_aliases.values(): + language = language.split('-')[0] + language = language.replace('-', '_').lower() + + return language + + # do search-request def request(query, params): if params['time_range'] and params['time_range'] not in time_range_dict: return params offset = (params['pageno'] - 1) * 10 + 1 - language = match_language(params['language'], supported_languages, language_aliases) - if language not in language_aliases.values(): - language = language.split('-')[0] - language = language.replace('-', '_').lower() + language = _get_language(params) params['url'] = _get_url(query, offset, language, params['time_range']) |