A complete Python toolkit for scraping, analyzing, and generating Baloto lottery numbers based on historical data from baloto.com.
This project helps you:
- Scrape historical Baloto lottery results
- Analyze patterns and frequencies in the data
- Generate strategic number combinations
- Understand the game rules and prize structure
- 🕷️ Web Scraper: Automatically scrapes lottery results from multiple pages (pages 2-96)
- 📊 Data Analyzer: Identifies hot/cold numbers, common pairs, and triplets
- 🎲 Number Generator: Creates combinations using 5 different strategies
- 📚 Complete Wiki: Detailed game rules, prize structure, and strategies
- 🔄 Automated: Handles pop-up modals and errors gracefully
- 💾 Export: Saves all results and analysis to text files
- Python 3.7 or higher
- Playwright
- Install the required dependencies:
pip install -r requirements.txt- Install Playwright browsers:
playwright install chromiumpython3 scraper.pyThis will scrape ~938 historical lottery draws and save to baloto_results.txt
python3 analyzer.pyThis will analyze patterns and save detailed statistics to analysis_report.txt
python3 number_generator.pyThis will generate strategic ticket combinations and save to generated_tickets.txt
BALOTO_WIKI.md - Complete game guide:
- Game rules and prize structure (9 ways to win!)
- Statistical insights from 938 draws
- Hot and cold numbers explained
WINNING_STRATEGIES.md - Strategic playbook:
- How to actually improve your chances
- 5 proven strategies with examples
- Budget-conscious playing tips
- What works and what doesn't
Scrapes historical results from baloto.com
Usage:
python3 scraper.pyAdvanced Usage:
from scraper import scrape_baloto_results, save_results_to_file
# Scrape specific page range
results = scrape_baloto_results(start_page=2, end_page=10)
save_results_to_file(results, "my_results.txt")Analyzes patterns in scraped data
Usage:
python3 analyzer.pyOutput:
- Hot and cold numbers
- Common pairs and triplets
- Frequency statistics
- Summary report
Generates strategic ticket combinations
Usage:
python3 number_generator.pyStrategies Included:
- 🔥 Pure Hot Numbers
- ⚖️ Balanced Hot/Cold Mix
- 🔗 Common Pair Combinations
- 📊 Spread Strategy
- 🎲 Random Lucky Numbers
- Navigates to each page on
https://baloto.com/resultados?page=X - Locates the table with
id="results-table" - Extracts all
<tr>elements from the table - For each row, finds the
<td>that contains the lottery numbers (the one withspan.balota-red-results) - Extracts the complete text which includes both the main numbers and the red balota number
- The result format is: "03 - 11 - 24 - 34 - 35 - 10"
- Displays progress after each page
- Saves all results to
baloto_results.txt
The script will:
- Display real-time progress in the console
- Show collected results after each page
- Save all results to
baloto_results.txtwhen complete
- The script uses
headless=Falseby default so you can see the browser in action. Change toheadless=Truein the code for background execution. - A 1-second delay is added between pages to be respectful to the server.
- The script handles errors gracefully and continues to the next page if one fails.
MIT License - feel free to use and modify as needed.