mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[mod] bing and duckduckgo engines : add / rename locale parameter
This commit is contained in:
parent
49c85fce51
commit
bf56ec4fb1
@ -5,7 +5,7 @@ number_of_results = 1
|
|||||||
|
|
||||||
[bing]
|
[bing]
|
||||||
engine = bing
|
engine = bing
|
||||||
language = en-us
|
locale = en-us
|
||||||
|
|
||||||
[cc]
|
[cc]
|
||||||
engine=currency_convert
|
engine=currency_convert
|
||||||
@ -20,6 +20,7 @@ engine = duckduckgo_definitions
|
|||||||
|
|
||||||
[duckduckgo]
|
[duckduckgo]
|
||||||
engine = duckduckgo
|
engine = duckduckgo
|
||||||
|
locale = en-us
|
||||||
|
|
||||||
[flickr]
|
[flickr]
|
||||||
engine = flickr
|
engine = flickr
|
||||||
|
@ -4,11 +4,11 @@ from cgi import escape
|
|||||||
|
|
||||||
base_url = 'http://www.bing.com/'
|
base_url = 'http://www.bing.com/'
|
||||||
search_string = 'search?{query}'
|
search_string = 'search?{query}'
|
||||||
language = 'en-us' # see http://msdn.microsoft.com/en-us/library/dd251064.aspx
|
locale = 'en-US' # see http://msdn.microsoft.com/en-us/library/dd251064.aspx
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
search_path = search_string.format(query=urlencode({'q': query, 'setmkt': language}))
|
search_path = search_string.format(query=urlencode({'q': query, 'setmkt': locale}))
|
||||||
#if params['category'] == 'images':
|
#if params['category'] == 'images':
|
||||||
# params['url'] = base_url + 'images/' + search_path
|
# params['url'] = base_url + 'images/' + search_path
|
||||||
params['url'] = base_url + search_path
|
params['url'] = base_url + search_path
|
||||||
|
@ -3,10 +3,11 @@ from urllib import urlencode
|
|||||||
from searx.utils import html_to_text
|
from searx.utils import html_to_text
|
||||||
|
|
||||||
url = 'https://duckduckgo.com/'
|
url = 'https://duckduckgo.com/'
|
||||||
search_url = url + 'd.js?{query}&l=us-en&p=1&s=0'
|
search_url = url + 'd.js?{query}&p=1&s=0'
|
||||||
|
locale = 'us-en'
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
params['url'] = search_url.format(query=urlencode({'q': query}))
|
params['url'] = search_url.format(query=urlencode({'q': query, 'l': locale}))
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user