1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Add Microsoft Academic search engine

This commit is contained in:
David A Roberts 2016-08-12 20:15:27 +10:00
parent 31866d9f33
commit 61fe5daf30
2 changed files with 32 additions and 7 deletions

View File

@ -6,7 +6,8 @@ search_url = None
url_query = None
content_query = None
title_query = None
# suggestion_xpath = ''
suggestion_query = ''
results_query = ''
# parameters for engines with paging support
#
@ -90,12 +91,23 @@ def request(query, params):
def response(resp):
results = []
json = loads(resp.text)
if results_query:
for result in query(json, results_query)[0]:
url = query(result, url_query)[0]
title = query(result, title_query)[0]
content = query(result, content_query)[0]
results.append({'url': url, 'title': title, 'content': content})
else:
for url, title, content in zip(
query(json, url_query),
query(json, title_query),
query(json, content_query)
):
results.append({'url': url, 'title': title, 'content': content})
urls = query(json, url_query)
contents = query(json, content_query)
titles = query(json, title_query)
for url, title, content in zip(urls, titles, contents):
results.append({'url': url, 'title': title, 'content': content})
if not suggestion_query:
return results
for suggestion in query(json, suggestion_query):
results.append({'suggestion': suggestion})
return results

View File

@ -287,6 +287,19 @@ engines:
timeout : 6.0
disabled : True
- name : microsoft academic
engine : json_engine
paging : True
search_url : https://academic.microsoft.com/api/search/GetEntityResults?query=%40{query}%40&filters=&offset={pageno}&limit=8&correlationId=undefined
results_query : results
url_query : u
title_query : dn
content_query : d
page_size : 8
first_page_num : 0
categories : science
shortcut : ma
- name : mixcloud
engine : mixcloud
shortcut : mc