mirror of
https://github.com/R0m1k3/Priceflow.git
synced 2026-10-11 17:29:14 +02:00
fix: Remove homepage redirect to avoid Amazon bot detection
Amazon detects the homepage-then-search pattern as bot behavior and blocks
with 2065 byte pages. Now navigating directly to search URL to appear more
natural.
This reverts the homepage loading strategy from commit 85b19e7 as Amazon's
bot detection has evolved and now flags this pattern.
This commit is contained in:
1 parent
95846ec606
commit
5d3d181f5e
1 file changed
+2
-13
@@ -247,19 +247,8 @@ class AmazonScraperService:
|
||||
page = await context.new_page()
|
||||
|
||||
try:
|
||||
# CRITICAL: Load Amazon homepage FIRST in same context to establish session
|
||||
logger.info("🏠 Loading Amazon homepage to establish session/cookies...")
|
||||
await page.goto("https://www.amazon.fr", wait_until="domcontentloaded", timeout=30000)
|
||||
logger.info("✅ Homepage loaded")
|
||||
|
||||
# Handle homepage popups
|
||||
await cls._handle_popups(page)
|
||||
|
||||
# Small delay
|
||||
await page.wait_for_timeout(2000)
|
||||
|
||||
# NOW navigate to search in SAME context (cookies preserved)
|
||||
logger.info(f"🔍 Navigating to search: {search_url}")
|
||||
# Navigate directly to search (Amazon detects homepage-then-search pattern as bot)
|
||||
logger.info(f"🔍 Navigating directly to search: {search_url}")
|
||||
await page.goto(search_url, wait_until="domcontentloaded", timeout=60000)
|
||||
logger.info("Page loaded (domcontentloaded)")
|
||||
|
||||
|
||||
Reference in new issue
Block a user