mirror of
https://github.com/searxng/searxng.git
synced 2025-07-16 09:49:21 +02:00
[fix] bing paging and language support
see https://msdn.microsoft.com/en-us/library/ff795620.aspx for bing specific search operators closes #755
This commit is contained in:
parent
7d26b3f8f8
commit
16ff8d06c7
2 changed files with 5 additions and 12 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue