mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
fix(amazon): parse eu and us price decimal formats
This commit is contained in:
parent
82e4272834
commit
53ccf575a6
1 changed files with 9 additions and 1 deletions
|
|
@ -87,7 +87,15 @@ def _float(value: str | None) -> float | None:
|
|||
if not match:
|
||||
return None
|
||||
token = match.group(0)
|
||||
if token.count(",") == 1 and "." not in token and len(token.rsplit(",", 1)[1]) <= 2:
|
||||
if "," in token and "." in token:
|
||||
decimal = "," if token.rfind(",") > token.rfind(".") else "."
|
||||
grouping = "." if decimal == "," else ","
|
||||
token = token.replace(grouping, "").replace(decimal, ".")
|
||||
elif (
|
||||
token.count(",") == 1
|
||||
and "." not in token
|
||||
and len(token.rsplit(",", 1)[1]) <= 2
|
||||
):
|
||||
token = token.replace(",", ".")
|
||||
else:
|
||||
token = token.replace(",", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue