mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-10-13 23:39:22 +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
@@ -136,6 +136,7 @@ class MicrodataExtractor(HTMLParser):
|
||||
if self.current_itemprop == 'price':
|
||||
# Try to extract numeric price from text
|
||||
try:
|
||||
# Not [^\d.] + float(), that breaks "39,99" (#4493), see Restock.parse_currency() for every caller
|
||||
price = Restock().parse_currency(data.strip())
|
||||
if price is not None:
|
||||
self.microdata['price'] = price
|
||||
@@ -240,7 +241,7 @@ def query_price_availability(extracted_data):
|
||||
if isinstance(price_val, (int, float)):
|
||||
result['price'] = float(price_val)
|
||||
elif isinstance(price_val, str):
|
||||
# Extract numeric value from string
|
||||
# Extract numeric value from string, see Restock.parse_currency() for every caller
|
||||
try:
|
||||
result['price'] = Restock().parse_currency(price_val)
|
||||
except ValueError:
|
||||
|
||||
Reference in new issue
Block a user