mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-23 15:18:12 +02:00
feat: Add centralized search configuration for e-commerce sites and a verification script.
This commit is contained in:
1 parent
f976ae1127
commit
8399b819da
3 files changed
+47
-3
No files matched your search
@@ -78,6 +78,14 @@ SITE_CONFIGS = {
|
|||||||
"category": "Discount",
|
"category": "Discount",
|
||||||
"requires_proxy": False,
|
"requires_proxy": False,
|
||||||
},
|
},
|
||||||
|
"action.com": {
|
||||||
|
"name": "Action",
|
||||||
|
"search_url": "https://www.action.com/fr-fr/search/?q={query}",
|
||||||
|
"product_selector": "a.group[href^='/fr-fr/p/']",
|
||||||
|
"wait_selector": "a.group[href^='/fr-fr/p/']",
|
||||||
|
"category": "Discount",
|
||||||
|
"requires_proxy": False,
|
||||||
|
},
|
||||||
"bmstores.fr": {
|
"bmstores.fr": {
|
||||||
"name": "B&M",
|
"name": "B&M",
|
||||||
"wait_selector": ".product-card, .search-results",
|
"wait_selector": ".product-card, .search-results",
|
||||||
@@ -95,8 +103,8 @@ SITE_CONFIGS = {
|
|||||||
"auchan.fr": {
|
"auchan.fr": {
|
||||||
"name": "Auchan",
|
"name": "Auchan",
|
||||||
"search_url": "https://www.auchan.fr/recherche?text={query}",
|
"search_url": "https://www.auchan.fr/recherche?text={query}",
|
||||||
"product_selector": "a[href*='/p-']",
|
"product_selector": "article a[href]",
|
||||||
"wait_selector": "a[href*='/p-']",
|
"wait_selector": "article",
|
||||||
"category": "Grande Surface",
|
"category": "Grande Surface",
|
||||||
"requires_proxy": False,
|
"requires_proxy": False,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Add project root to path
|
||||||
|
sys.path.append(os.getcwd())
|
||||||
|
|
||||||
|
from app.services.direct_search_service import direct_search_service
|
||||||
|
from app.core.search_config import SITE_CONFIGS
|
||||||
|
|
||||||
|
# Configure logging
|
||||||
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
async def verify_site(site_key):
|
||||||
|
logger.info(f"Verifying {site_key}...")
|
||||||
|
try:
|
||||||
|
results = await direct_search_service.search_site(site_key, "chaise")
|
||||||
|
if results:
|
||||||
|
logger.info(f"✅ {site_key}: Found {len(results)} results")
|
||||||
|
for i, res in enumerate(results[:3]):
|
||||||
|
title = res.get('title', 'No Title')
|
||||||
|
price = res.get('price', 'No Price')
|
||||||
|
url = res.get('url', 'No URL')
|
||||||
|
logger.info(f" {i+1}. {title[:50]}... - {price} - {url[:50]}...")
|
||||||
|
else:
|
||||||
|
logger.error(f"❌ {site_key}: No results found")
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"❌ {site_key}: Error - {e}")
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
await verify_site("action.com")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
+1
-1
@@ -32,7 +32,7 @@ async def verify_site(site_key):
|
|||||||
logger.error(f"❌ {site_key}: Error - {e}")
|
logger.error(f"❌ {site_key}: Error - {e}")
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
sites_to_test = ["gifi.fr", "stokomani.fr", "auchan.fr", "carrefour.fr", "amazon.fr"]
|
sites_to_test = ["gifi.fr", "stokomani.fr", "auchan.fr", "carrefour.fr", "amazon.fr", "action.com"]
|
||||||
|
|
||||||
# Run sequentially to avoid overwhelming resources/logs
|
# Run sequentially to avoid overwhelming resources/logs
|
||||||
for site in sites_to_test:
|
for site in sites_to_test:
|
||||||
|
|||||||
Reference in new issue
Block a user