diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-11-07 22:30:20 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-11-07 22:30:20 +0100 |
commit | 16ff8d06c73d3e0ec784e8c9a1fb38b36a95d8fb (patch) | |
tree | 6330717ee3115eed8c135bb0512c5b6525c5522f /searx/engines/bing.py | |
parent | 7d26b3f8f8659491d3da94aeb71bd0d9b5f7a257 (diff) | |
download | searxng-16ff8d06c73d3e0ec784e8c9a1fb38b36a95d8fb.tar.gz searxng-16ff8d06c73d3e0ec784e8c9a1fb38b36a95d8fb.zip |
[fix] bing paging and language support
see https://msdn.microsoft.com/en-us/library/ff795620.aspx for bing
specific search operators
closes #755
Diffstat (limited to 'searx/engines/bing.py')
-rw-r--r-- | searx/engines/bing.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/searx/engines/bing.py b/searx/engines/bing.py index 6bdfd378b..b9c5f73fc 100644 --- a/searx/engines/bing.py +++ b/searx/engines/bing.py @@ -32,18 +32,13 @@ search_string = 'search?{query}&first={offset}' def request(query, params): offset = (params['pageno'] - 1) * 10 + 1 - if params['language'] == 'all': - language = 'en-US' - else: - language = params['language'].replace('_', '-') + if params['language'] != 'all': + query = 'language:{} {}'.format(params['language'].split('_')[0].upper(), query) search_path = search_string.format( - query=urlencode({'q': query, 'setmkt': language}), + query=urlencode({'q': query}), offset=offset) - params['cookies']['SRCHHPGUSR'] = \ - 'NEWWND=0&NRSLT=-1&SRCHLANG=' + language.split('-')[0] - params['url'] = base_url + search_path return params |