Add diagnostic logging to Chrome fallback
All checks were successful
Release / build (push) Successful in 1m32s
All checks were successful
Release / build (push) Successful in 1m32s
Log navigation, polling state, and response snippets so we can diagnose whether the fallback fails due to Cloudflare challenge, login redirect, profile lock, or other issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,11 +102,13 @@ func fetchWithFallback(url, sessionKey string) ([]byte, error) {
|
||||
}
|
||||
if status == 403 {
|
||||
// Likely a Cloudflare JS challenge — fall back to headless Chrome
|
||||
log.Printf("HTTP 403 for %s, falling back to headless Chrome", url)
|
||||
log.Printf("HTTP 403 for %s, falling back to Chrome", url)
|
||||
chromeBody, chromeErr := browser.FetchViaChrome(url)
|
||||
if chromeErr != nil {
|
||||
return nil, fmt.Errorf("auth_expired") // treat as auth failure if Chrome also fails
|
||||
log.Printf("Chrome fallback failed: %v", chromeErr)
|
||||
return nil, fmt.Errorf("auth_expired")
|
||||
}
|
||||
log.Printf("Chrome fallback succeeded (%d bytes)", len(chromeBody))
|
||||
return chromeBody, nil
|
||||
}
|
||||
return nil, fmt.Errorf("HTTP %d", status)
|
||||
|
||||
Reference in New Issue
Block a user