Prerequisites
- Python 3.8 or higher installed
- API key for the X-Net header generation service
- Basic terminal/command line knowledge
If you don’t have an API key yet, contact the developer via Discord to request access.
Getting Started
Install Dependencies
First, install the required Python packages:This installs three core dependencies:
- curl_cffi: Low-level HTTP client with TLS fingerprinting support
- tls_client: Additional TLS client for API communication
- prettytable: Table formatting for displaying scraped data
Configure API Credentials
Create or edit the
config.json file in your project root:Optional Configuration:
proxy: Add a proxy URL (format:http://user:pass@host:port) for enhanced reliabilityemailandpassword: Reserved for future authentication features
Initialize the Session
Create a new Python file or use the provided The
main.py:Bet365AndroidSession handles:- TLS fingerprinting to match Android devices
- Cookie management and device ID generation
- Anti-bot protection headers
Navigate to Homepage
Establish a session by visiting the Bet365 homepage:This critical step:
- Establishes cookies and session tokens
- Extracts the SST (Session State Token) for subsequent requests
- Initializes device fingerprinting
The homepage navigation may take longer than expected due to
curl_cffi initialization. This is normal behavior.Extract Available Sports
Retrieve the list of all available sports from Bet365:Each
Sport object contains:name: Human-readable sport name (e.g., “Soccer”, “Tennis”)PD: Bet365’s internal page descriptor identifier
Scrape Sport Homepage Data
Extract odds and match data from a specific sport:This method:
- Fetches splash pods containing match data
- Parses tables with odds, teams, and market information
- Pretty-prints the data to console
- Saves raw response to
response.txtfor debugging
Complete Working Example
Here’s the fullmain.py implementation:
Understanding the Output
The SDK will display:- Pretty-printed tables: Match data formatted using
prettytable - Raw response file:
response.txtcontains the full API response for debugging - Console logs: Progress indicators and error messages
Troubleshooting
500 Internal Error: Usually indicates:
- Bad IP address or proxy
- Configuration endpoint is unavailable
- Rate limiting triggered
Common Issues
API Key Invalidapi_key in config.json is correct
Assertion Error During Homepage
pip3 install -r requirements.txt to install dependencies
Next Steps
Now that you have a working scraper:API Reference
Explore all available methods and parameters
Core Concepts
Learn about anti-bot protection and TLS fingerprinting
Message Parsing
Understand Bet365’s message format and parsing
Error Handling
Best practices for handling errors and edge cases