mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-15 19:27:17 +02:00
feat: Implement direct e-commerce search service using Playwright/Browserless to scrape product information from various configured retail websites.
This commit is contained in:
1 parent
97039484fa
commit
ee8a14668c
1 file changed
+10
@@ -555,6 +555,16 @@ async def _search_site_browserless( # noqa: PLR0912, PLR0915
|
|||||||
|
|
||||||
context = None
|
context = None
|
||||||
page = None
|
page = None
|
||||||
|
max_retries = 3 if "amazon" in domain else 1
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
if attempt > 0:
|
||||||
|
# Exponential backoff with jitter for Amazon retries
|
||||||
|
base_delay = AMAZON_BASE_DELAY * (2 ** attempt)
|
||||||
|
jitter = random.uniform(0.5, 1.5)
|
||||||
|
delay = min(base_delay * jitter, AMAZON_MAX_DELAY)
|
||||||
|
logger.info(f"Amazon retry {attempt + 1}/{max_retries} for '{query}' after {delay:.1f}s delay")
|
||||||
|
await asyncio.sleep(delay)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Créer un nouveau contexte isolé pour ce site
|
# Créer un nouveau contexte isolé pour ce site
|
||||||
|
|||||||
Reference in new issue
Block a user