Skip to content

majortomate/baloto-results-script

Repository files navigation

Baloto Lottery Analysis & Number Generator

A complete Python toolkit for scraping, analyzing, and generating Baloto lottery numbers based on historical data from baloto.com.

🎯 Project Overview

This project helps you:

  1. Scrape historical Baloto lottery results
  2. Analyze patterns and frequencies in the data
  3. Generate strategic number combinations
  4. Understand the game rules and prize structure

✨ Features

  • 🕷️ 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

Requirements

  • Python 3.7 or higher
  • Playwright

Installation

  1. Install the required dependencies:
pip install -r requirements.txt
  1. Install Playwright browsers:
playwright install chromium

📖 Quick Start Guide

Step 1: Scrape Historical Results

python3 scraper.py

This will scrape ~938 historical lottery draws and save to baloto_results.txt

Step 2: Analyze the Data

python3 analyzer.py

This will analyze patterns and save detailed statistics to analysis_report.txt

Step 3: Generate Number Combinations

python3 number_generator.py

This will generate strategic ticket combinations and save to generated_tickets.txt

Step 4: Read the Guides

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

📚 Available Tools

🕷️ scraper.py - Web Scraper

Scrapes historical results from baloto.com

Usage:

python3 scraper.py

Advanced 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")

📊 analyzer.py - Data Analyzer

Analyzes patterns in scraped data

Usage:

python3 analyzer.py

Output:

  • Hot and cold numbers
  • Common pairs and triplets
  • Frequency statistics
  • Summary report

🎲 number_generator.py - Number Generator

Generates strategic ticket combinations

Usage:

python3 number_generator.py

Strategies Included:

  1. 🔥 Pure Hot Numbers
  2. ⚖️ Balanced Hot/Cold Mix
  3. 🔗 Common Pair Combinations
  4. 📊 Spread Strategy
  5. 🎲 Random Lucky Numbers

How It Works

  1. Navigates to each page on https://baloto.com/resultados?page=X
  2. Locates the table with id="results-table"
  3. Extracts all <tr> elements from the table
  4. For each row, finds the <td> that contains the lottery numbers (the one with span.balota-red-results)
  5. Extracts the complete text which includes both the main numbers and the red balota number
  6. The result format is: "03 - 11 - 24 - 34 - 35 - 10"
  7. Displays progress after each page
  8. Saves all results to baloto_results.txt

Output

The script will:

  • Display real-time progress in the console
  • Show collected results after each page
  • Save all results to baloto_results.txt when complete

Notes

  • The script uses headless=False by default so you can see the browser in action. Change to headless=True in 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.

License

MIT License - feel free to use and modify as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages