summaryrefslogtreecommitdiff
path: root/searx/engines/currency_convert.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-10-04 22:46:47 +0200
committerAdam Tauber <asciimoo@gmail.com>2014-10-04 22:46:47 +0200
commit67b69619ba8fbf17820f303093e883055531efff (patch)
tree50ada9411ed2e2ad13125a542f0f7b24360e2e62 /searx/engines/currency_convert.py
parentfce6fb2fa8f1b95d36b8043e0cea160b2f9fc633 (diff)
parent63a0328c8b26c5d749ecf83ee73a44902e1d5cef (diff)
Merge pull request #104 from dalf/master
[enh] add infoboxes and answers, [fix] when two results are merged, really use the content with more text
Diffstat (limited to 'searx/engines/currency_convert.py')
-rw-r--r--searx/engines/currency_convert.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py
index 561527bce..b5f0953d8 100644
--- a/searx/engines/currency_convert.py
+++ b/searx/engines/currency_convert.py
@@ -38,16 +38,14 @@ def response(resp):
except:
return results
- title = '{0} {1} in {2} is {3}'.format(
+ answer = '{0} {1} = {2} {3} (1 {1} = {4} {3})'.format(
resp.search_params['ammount'],
resp.search_params['from'],
+ resp.search_params['ammount'] * conversion_rate,
resp.search_params['to'],
- resp.search_params['ammount'] * conversion_rate
+ conversion_rate
)
- content = '1 {0} is {1} {2}'.format(resp.search_params['from'],
- conversion_rate,
- resp.search_params['to'])
now_date = datetime.now().strftime('%Y%m%d')
url = 'http://finance.yahoo.com/currency/converter-results/{0}/{1}-{2}-to-{3}.html' # noqa
url = url.format(
@@ -56,6 +54,7 @@ def response(resp):
resp.search_params['from'].lower(),
resp.search_params['to'].lower()
)
- results.append({'title': title, 'content': content, 'url': url})
+
+ results.append({'answer' : answer, 'url': url})
return results