summaryrefslogtreecommitdiff
path: root/searx/engines/wolframalpha_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/wolframalpha_api.py')
-rw-r--r--searx/engines/wolframalpha_api.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/searx/engines/wolframalpha_api.py b/searx/engines/wolframalpha_api.py
index d61d25747..4c99eac95 100644
--- a/searx/engines/wolframalpha_api.py
+++ b/searx/engines/wolframalpha_api.py
@@ -48,13 +48,16 @@ def response(resp):
if search_results.xpath('/queryresult[attribute::success="false"]'):
return []
- # parse result
- result = search_results.xpath('//pod[attribute::primary="true"]/subpod/plaintext')[0].text
- result = replace_pua_chars(result)
+ # parse answer
+ answer = search_results.xpath('//pod[attribute::primary="true"]/subpod/plaintext')
+ if not answer:
+ return results
+
+ answer = replace_pua_chars(answer[0].text)
# append result
# TODO: shouldn't it bind the source too?
- results.append({'answer': result})
+ results.append({'answer': answer})
# return results
return results