mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-19 05:09:17 +02:00
feat: Add web scraping service for tracking and AI extraction verification script.
This commit is contained in:
1 parent
6fab64b229
commit
5428459f36
3 files changed
+143
-27
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add project root to path
|
||||
sys.path.append(os.getcwd())
|
||||
|
||||
from app.services.ai_price_extractor import AIPriceExtractor
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
async def verify_ai_extractor():
|
||||
print("Verifying AIPriceExtractor on Gifi dump...")
|
||||
|
||||
# Load the dump file
|
||||
dump_path = "gifi_full.html"
|
||||
if not os.path.exists(dump_path):
|
||||
print(f"Error: {dump_path} not found.")
|
||||
return
|
||||
|
||||
with open(dump_path, "r", encoding="utf-8") as f:
|
||||
html = f.read()
|
||||
|
||||
title = "Gifi Product Test"
|
||||
|
||||
print("Calling AIPriceExtractor...")
|
||||
price = await AIPriceExtractor.extract_price(html, title)
|
||||
|
||||
print("\n--- AI Extraction Results ---")
|
||||
print(f"Price: {price}€")
|
||||
|
||||
if price is not None:
|
||||
print("\nSUCCESS: AIPriceExtractor worked!")
|
||||
else:
|
||||
print("\nFAILURE: AIPriceExtractor returned None.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(verify_ai_extractor())
|
||||
Reference in new issue
Block a user