A Python-based cricket data scraping system that collects match information, squads, live match updates, and scorecards from CREX and stores the data in MongoDB Atlas.
Cricket Scraper automates the process of collecting cricket match data from CREX. The project is designed with a modular structure, making it easy to maintain and extend.
The scraper currently supports:
- Match URL collection
- Match information scraping
- Squad and Playing XI extraction
- Live match updates
- Scorecard collection
- MongoDB Atlas integration
- Fetches match URLs from the CREX schedule page
- Supports multiple matches in a single execution
- Collects match details
- Venue information
- Match metadata
- Playing XI information
- Extracts squad details
- Stores team-wise lineup information
- Captures live score updates
- Tracks ongoing match information
- Retrieves batting scorecards
- Retrieves bowling scorecards
- Stores score summaries
- MongoDB Atlas support
- Automatic document updates using upsert operations
- Separate collections for different data types
| Technology | Purpose |
|---|---|
| Python | Core Development |
| Selenium | Web Scraping |
| MongoDB Atlas | Database |
| PyMongo | MongoDB Integration |
| WebDriver Manager | Browser Driver Management |
| Python Dotenv | Environment Configuration |
CricketScraper/
│
├── database/
│ └── mongodb.py
│
├── schemas/
│ ├── match_schema.py
│ ├── squad_schema.py
│ ├── live_schema.py
│ └── scorecard_schema.py
│
├── scrappers/
│ ├── match_list_scraper.py
│ ├── match_info_scraper.py
│ ├── squads_scraper.py
│ ├── live_scraper.py
│ └── scorecard_scraper.py
│
├── utils/
│ ├── driver.py
│ ├── logger.py
│ ├── config.py
│ ├── helpers.py
│ └── constants.py
│
├── logs/
│
├── main.py
├── requirements.txt
├── .env.example
└── README.md
git clone <repository-url>
cd CricketScraperpython -m venv venvWindows
venv\Scripts\activateLinux / macOS
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the root directory.
MONGO_URI=your_mongodb_connection_stringExample:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/python run_all.pypython scrappers/match_list_scraper.pypython scrappers/match_info_scraper.pypython scrappers/squads_scraper.pypython scrappers/live_scraper.pypython scrappers/scorecard_scraper.pyStores:
- Match ID
- Match URL
- Match Information
Stores:
- Squad Information
- Playing XI Details
Stores:
- Live Match Updates
- Current Match State
Stores:
- Batting Scorecard
- Bowling Scorecard
- Match Summary
CREX Schedule
│
▼
Match URLs
│
▼
Match Information
│
▼
Squads
│
▼
Live Scores
│
▼
Scorecards
│
▼
MongoDB Atlas
You can add screenshots here after running the project.


- Redis Caching
- Celery Task Scheduling
- Docker Support
- REST API Integration
- Structured Data Extraction
- Automated Scheduling
- Unit Testing
- CI/CD Pipeline
- MongoDB Atlas is used as the primary database.
- Configuration values are managed using environment variables.
- The current implementation stores scraped page content and can be extended to extract structured statistics.
- The project is designed to be easily extended with caching, scheduling, and API layers in future versions.