mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-10-13 15:30:27 +00:00
LLM restock: use Restock.parse_currency() like the other price extractors
Same parser c8afea1b (#4494) moved the structured-data extractors to, so
there's one place price text becomes a number. parse_currency() now lists
every caller, and the call sites point back to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6837652e44
commit
d71cd57f32
4 files changed
+12
-6
No files matched your search
@@ -335,9 +335,10 @@ def get_itemprop_availability_override(content, fetcher_name, fetcher_instance,
|
||||
try:
|
||||
if isinstance(price, str):
|
||||
# The model sometimes returns the price as page text ("1.299,95 €"), stripping
|
||||
# everything but digits and dots would turn that into 1.29995
|
||||
from price_parser import Price
|
||||
price = Price.fromstring(price).amount_float
|
||||
# everything but digits and dots would turn that into 1.29995. Same parser as the
|
||||
# structured-data extractors, see Restock.parse_currency() for every caller.
|
||||
from changedetectionio.processors.restock_diff import Restock
|
||||
price = Restock().parse_currency(price)
|
||||
else:
|
||||
price = float(price)
|
||||
except (ValueError, TypeError):
|
||||
|
||||
Reference in new issue
Block a user