|
@@ -8,9 +8,11 @@
|
8
|
8
|
|
9
|
9
|
|
10
|
10
|
|
|
11
|
+from cgi import escape
|
11
|
12
|
from json import loads
|
12
|
13
|
from time import time
|
13
|
14
|
from urllib import urlencode
|
|
15
|
+from lxml.etree import XML
|
14
|
16
|
|
15
|
17
|
from searx.poolrequests import get as http_get
|
16
|
18
|
|
|
@@ -34,7 +36,7 @@ search_url = url + 'input/json.jsp'\
|
34
|
36
|
referer_url = url + 'input/?{query}'
|
35
|
37
|
|
36
|
38
|
token = {'value': '',
|
37
|
|
- 'last_updated': 0}
|
|
39
|
+ 'last_updated': None}
|
38
|
40
|
|
39
|
41
|
|
40
|
42
|
|
|
@@ -80,8 +82,8 @@ def response(resp):
|
80
|
82
|
|
81
|
83
|
|
82
|
84
|
result_chunks = []
|
83
|
|
- infobox_title = None
|
84
|
|
- result = ""
|
|
85
|
+ infobox_title = ""
|
|
86
|
+ result_content = ""
|
85
|
87
|
for pod in resp_json['queryresult']['pods']:
|
86
|
88
|
pod_id = pod.get('id', '')
|
87
|
89
|
pod_title = pod.get('title', '')
|
|
@@ -99,8 +101,9 @@ def response(resp):
|
99
|
101
|
if subpod['plaintext'] != '(requires interactivity)':
|
100
|
102
|
result_chunks.append({'label': pod_title, 'value': subpod['plaintext']})
|
101
|
103
|
|
102
|
|
- if pod_is_result:
|
103
|
|
- result = subpod['plaintext']
|
|
104
|
+ if pod_is_result or not result_content:
|
|
105
|
+ if pod_id != "Input":
|
|
106
|
+ result_content = pod_title + ': ' + subpod['plaintext']
|
104
|
107
|
|
105
|
108
|
elif 'img' in subpod:
|
106
|
109
|
result_chunks.append({'label': pod_title, 'image': subpod['img']})
|
|
@@ -113,7 +116,7 @@ def response(resp):
|
113
|
116
|
'urls': [{'title': 'Wolfram|Alpha', 'url': resp.request.headers['Referer'].decode('utf8')}]})
|
114
|
117
|
|
115
|
118
|
results.append({'url': resp.request.headers['Referer'].decode('utf8'),
|
116
|
|
- 'title': infobox_title + ' - Wolfram|Alpha',
|
117
|
|
- 'content': result})
|
|
119
|
+ 'title': 'Wolfram|Alpha (' + infobox_title + ')',
|
|
120
|
+ 'content': result_content})
|
118
|
121
|
|
119
|
122
|
return results
|