mirror of https://github.com/searx/searx
[fix] style of stackexchange engine
This commit is contained in:
parent
a1f9919587
commit
1d5feed4c1
|
@ -23,26 +23,28 @@ paging = True
|
||||||
pagesize = 10
|
pagesize = 10
|
||||||
|
|
||||||
api_site = 'stackoverflow'
|
api_site = 'stackoverflow'
|
||||||
api_sort= 'activity'
|
api_sort = 'activity'
|
||||||
api_order = 'desc'
|
api_order = 'desc'
|
||||||
|
|
||||||
# https://api.stackexchange.com/docs/advanced-search
|
# https://api.stackexchange.com/docs/advanced-search
|
||||||
search_api = 'https://api.stackexchange.com/2.3/search/advanced?'
|
search_api = 'https://api.stackexchange.com/2.3/search/advanced?'
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
|
||||||
args = urlencode({
|
args = urlencode({
|
||||||
'q' : query,
|
'q': query,
|
||||||
'page' : params['pageno'],
|
'page': params['pageno'],
|
||||||
'pagesize' : pagesize,
|
'pagesize': pagesize,
|
||||||
'site' : api_site,
|
'site': api_site,
|
||||||
'sort' : api_sort,
|
'sort': api_sort,
|
||||||
'order': 'desc',
|
'order': api_order,
|
||||||
})
|
})
|
||||||
params['url'] = search_api + args
|
params['url'] = search_api + args
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
def response(resp):
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
@ -58,7 +60,7 @@ def response(resp):
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'url': "https://%s.com/q/%s" % (api_site, result['question_id']),
|
'url': "https://%s.com/q/%s" % (api_site, result['question_id']),
|
||||||
'title': html.unescape(result['title']),
|
'title': html.unescape(result['title']),
|
||||||
'content': html.unescape(content),
|
'content': html.unescape(content),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue