mirror of https://github.com/searx/searx
[enh] currency_convert: allow strings like google's "convert 1 euro to dollars"
This commit is contained in:
parent
3c6a54012c
commit
fe2ce83e41
|
@ -9,7 +9,7 @@ categories = []
|
||||||
url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
|
url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
|
||||||
weight = 100
|
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
|
db = 1
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ def request(query, params):
|
||||||
# wrong query
|
# wrong query
|
||||||
return params
|
return params
|
||||||
|
|
||||||
ammount, from_currency, to_currency = m.groups()
|
ammount, from_currency, none, to_currency = m.groups()
|
||||||
ammount = float(ammount)
|
ammount = float(ammount)
|
||||||
from_currency = name_to_iso4217(from_currency.strip())
|
from_currency = name_to_iso4217(from_currency.strip())
|
||||||
to_currency = name_to_iso4217(to_currency.strip())
|
to_currency = name_to_iso4217(to_currency.strip())
|
||||||
|
|
Loading…
Reference in New Issue