mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-22 23:31:12 +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:
|
if not match:
|
||||||
return None
|
return None
|
||||||
token = match.group(0)
|
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(",", ".")
|
token = token.replace(",", ".")
|
||||||
else:
|
else:
|
||||||
token = token.replace(",", "")
|
token = token.replace(",", "")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue