This commit is contained in:
@ -41,28 +41,26 @@ def identity(arg):
|
|||||||
def response(resp):
|
def response(resp):
|
||||||
results = []
|
results = []
|
||||||
json = loads(resp.text)
|
json = loads(resp.text)
|
||||||
|
|
||||||
title_filter = identity
|
title_filter = identity
|
||||||
content_filter = identity
|
content_filter = identity
|
||||||
|
|
||||||
for search_result in json:
|
search_result = json['data']['pages']['search']
|
||||||
search = search_result['data']['pages']['search']
|
rs = search_result['results']
|
||||||
rs = search['results']
|
if not len(rs):
|
||||||
if not len(rs):
|
return results
|
||||||
return results
|
for result in rs:
|
||||||
for result in rs:
|
try:
|
||||||
try:
|
url = result['path']
|
||||||
url = result['path']
|
title = result['title']
|
||||||
title = result['title']
|
except:
|
||||||
except:
|
continue
|
||||||
continue
|
results.append(
|
||||||
results.append(
|
{
|
||||||
{
|
'url': host + to_string(url),
|
||||||
'url': host + to_string(url),
|
'title': to_string(title),
|
||||||
'title': to_string(title),
|
'content': '',
|
||||||
'content': '',
|
}
|
||||||
}
|
)
|
||||||
)
|
for suggestion in search_result['suggestions']:
|
||||||
for suggestion in search['suggestions']:
|
results.append({'suggestion': suggestion})
|
||||||
results.append({'suggestion': suggestion})
|
|
||||||
return results
|
return results
|
||||||
|
Reference in New Issue
Block a user