From 584d59a8cf20d059a9e2a5cf7e656c17a0e98981 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Fri, 15 May 2026 16:07:13 +0300 Subject: [PATCH] docs: noteaza lectiile de deployment (headless/WAF, Session 0, sleep-uri) Co-Authored-By: Claude Opus 4.7 --- CLAUDE.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index c60af23..34b2151 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,7 +8,23 @@ BTGO Scraper - Playwright automation for extracting account balances and transac **Security Context**: Authorized personal banking automation tool for educational purposes. -**CRITICAL**: Docker/headless mode is **BLOCKED by WAF**. ONLY works locally with `HEADLESS=false`. +**CRITICAL**: Docker is **BLOCKED by WAF** (datacenter IP). Run locally only. + +## Lessons Learned (deployment) + +- **Headless vs WAF**: Akamai blocks the *old* headless mode (plain `headless=True`), + but the *new* headless mode (`--headless=new`) passes. Launch with `headless=False` + + arg `--headless=new` + a clean Chrome UA (the headless UA contains `HeadlessChrome`, + which Akamai detects). +- **Session 0 has no GPU**: Running as a Windows Service (no user logged in) means + Chromium does software rendering -> CPU 100%, slow. Mitigation, not a cure: smaller + viewport (1366x768, ~50% fewer pixels than 1920x1080; must stay >~1100px or BT shows + a "redirect to store" splash) + overhead flags (`--disable-gpu` etc.). The real fix + for speed would be running outside Session 0, with a GPU. +- **No fixed `time.sleep()` for page state**: on the slow prod machine, hardcoded + waits time out. Always wait on a selector/condition (`wait_for_selector`), generously. +- **`networkidle` never fires**: BT pages poll trackers continuously. Use + `domcontentloaded` + explicit selector waits. ## Coding Guidelines