diff options
author | Maxqia <contrib@maxqia.com> | 2016-04-30 20:48:15 -0700 |
---|---|---|
committer | Maxqia <contrib@maxqia.com> | 2016-04-30 20:48:15 -0700 |
commit | fe2ce83e4111ade744951f4e9701b5dd7258b39b (patch) | |
tree | 780c8bd124e903ff31f048e87619750d49998123 /searx/engines | |
parent | 3c6a54012c157667f1efcb23a9652b973b80cbce (diff) | |
download | searxng-fe2ce83e4111ade744951f4e9701b5dd7258b39b.tar.gz searxng-fe2ce83e4111ade744951f4e9701b5dd7258b39b.zip |
[enh] currency_convert: allow strings like google's "convert 1 euro to dollars"
Diffstat (limited to 'searx/engines')
-rw-r--r-- | searx/engines/currency_convert.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index 26830a167..bdcd8f711 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -9,7 +9,7 @@ categories = [] url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X' weight = 100 -parser_re = re.compile(u'^\W*(\d+(?:\.\d+)?)\W*([^.0-9].+)\W+in?\W+([^\.]+)\W*$', re.I) # noqa +parser_re = re.compile(u'.*?(\d+(?:\.\d+)?) ([^.0-9].+) (in|to) ([^\.]+)\W*$', re.I) # noqa db = 1 @@ -40,7 +40,7 @@ def request(query, params): # wrong query return params - ammount, from_currency, to_currency = m.groups() + ammount, from_currency, none, to_currency = m.groups() ammount = float(ammount) from_currency = name_to_iso4217(from_currency.strip()) to_currency = name_to_iso4217(to_currency.strip()) |