The Bet365 Scraper SDK implements sophisticated techniques to bypass anti-bot detection systems, including Cloudflare protection. This page explains the mechanisms used to maintain successful scraping operations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/enter-a-new-username3/bet365-scraper-demo/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Bet365 employs multiple layers of protection to detect and block automated scraping:- Cloudflare Protection: Advanced bot detection and challenge systems
- TLS Fingerprinting: Server-side analysis of TLS handshake patterns
- Header Validation: Strict checking of HTTP headers and User-Agent strings
- Cookie Management: Session tracking and device fingerprinting
- Custom Headers: Proprietary anti-bot headers like
X-Net-Sync-Term-Android
Protected Request Method
The core of the anti-bot protection is implemented in theprotected_get() method of the Bet365AndroidSession class:
The
protected_get() method automatically applies TLS fingerprinting, custom headers, and cookie management to every request.User-Agent Configuration
The SDK mimics the official Bet365 Android app by using authentic User-Agent strings:- Device Information: Android 12 Phone with specific model (M2003J15SC)
- Browser Engine: Chrome 144.0.7559.59 Gen6
- App Version: bet365/8.0.36.00
- App ID Header: Identifies the specific app version and region (row = rest of world)
X-Net-Sync-Term-Android Header
Bet365 uses a proprietary anti-bot header calledX-Net-Sync-Term-Android that validates request authenticity. This header is generated dynamically for each request:
- URL: The target request URL
- Cookie Header: Current session cookies
- Post Hash: SHA-256 hash of POST data (empty for GET requests)
- SST: Site security token obtained during initialization
- Device ID: Persistent device identifier
The X-Net-Sync-Term-Android header generation requires an API key and uses an external service. This is a critical component that cannot be bypassed.
Cloudflare Protection Handling
The SDK includes specific error handling for Cloudflare protection:- 403 Forbidden: IP reputation issues or invalid headers
- 503 Service Unavailable: Challenge page requiring JavaScript execution
- 429 Too Many Requests: Rate limiting triggered
Session Management and Cookies
Proper session and cookie management is critical for avoiding detection:Device ID Generation
Cookie Building
USDI Cookie
usdi cookie contains the unique device identifier used for fingerprinting.
Configuration Initialization
The SDK must properly initialize by fetching site configuration that includes the SST (Site Security Token):X-Net-Sync-Term-Android headers.
Thread Safety
Cookie operations are protected with thread locks to prevent race conditions:Best Practices
1. Use Residential Proxies
2. Respect Rate Limits
Implement delays between requests to mimic human behavior:3. Maintain Session State
Reuse the same session object across requests:4. Update Headers Regularly
Bet365 updates their app frequently. Monitor for changes:- App version numbers (8.0.36.00)
- Chrome version (144.0.7559.59)
- Device models and OS versions
5. Handle Errors Gracefully
Security Headers
The SDK includes comprehensive security headers that match the Android WebView:Troubleshooting
403 Forbidden Errors
- Check IP Reputation: Switch to a different proxy
- Verify Headers: Ensure User-Agent and app version are current
- Check API Key: Validate X-Net-Sync-Term-Android generation
Invalid Token Errors
- Verify SST: Ensure
go_homepage()was called successfully - Check Device ID: Verify device_id format is correct
- Validate Cookies: Ensure pstk cookie exists
Session Expiration
- Re-initialize: Call
go_homepage()again - Check Cookie Lifetime: Some cookies expire after 30 minutes
- Verify Connection: Ensure network connectivity is stable
The SDK automatically handles most anti-bot protection mechanisms, but understanding these concepts helps troubleshoot issues and optimize performance.