From d05c676ed5b1dc5372b1cb380740161b3613f7cc Mon Sep 17 00:00:00 2001 From: a01200356 Date: Sat, 2 Jan 2016 22:29:20 -0600 Subject: Add test case in wolframalpha_noapi [fix] Display multiple answers in wolframalpha_api --- searx/engines/wolframalpha_api.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'searx/engines/wolframalpha_api.py') diff --git a/searx/engines/wolframalpha_api.py b/searx/engines/wolframalpha_api.py index d4127be4c..540d81351 100644 --- a/searx/engines/wolframalpha_api.py +++ b/searx/engines/wolframalpha_api.py @@ -52,12 +52,13 @@ def response(resp): if search_results.xpath(failure_xpath): return [] - # parse answer - answer = search_results.xpath(answer_xpath) - if answer: - answer = replace_pua_chars(answer[0].text) + # parse answers + answers = search_results.xpath(answer_xpath) + if answers: + for answer in answers: + answer = replace_pua_chars(answer.text) - results.append({'answer': answer}) + results.append({'answer': answer}) # TODO: append a result with title and link, like in the no api version -- cgit v1.2.3