A Python-based web scraper that collects event information from various venues, processes the data using Claude AI, and sends a formatted email digest of upcoming events.
events-scraper/
├── analyzers/ # Event analysis modules
│ ├── claude.py # Claude AI integration for event processing
│ ├── base.py # Base analyzer class
│ ├── date_parser.py # Date parsing utilities
│ └── __init__.py
├── notifications/ # Notification services
│ ├── email.py # Email notification service
│ ├── base.py # Base notifier class
│ └── __init__.py
├── scrapers/ # Web scrapers for different venues
│ ├── petaluma.py # Petaluma venue scraper
│ ├── california.py # California Theatre scraper
│ ├── northbay.py # North Bay scraper
│ ├── base.py # Base scraper class
│ └── __init__.py
├── .env # Environment variables (not tracked in git)
├── config.json # Configuration file
├── crontab # Crontab configuration for Docker
├── Dockerfile # Docker configuration
├── monitor.py # Main application entry point
├── requirements.txt # Python dependencies
├── run # Bash script to run the Docker container
├── test_email.py # Utility script to test email functionality
└── README.md # This file
- Scraping: The application scrapes event information from configured venues using Playwright.
- Analysis: Collected event data is sent to Claude AI for analysis and formatting.
- Notification: The formatted event information is sent as an email digest.
ANTHROPIC_API_KEY=your_anthropic_api_key
SMTP_SERVER=your_smtp_server
SMTP_PORT=your_smtp_port
SMTP_USERNAME=your_smtp_username
SMTP_PASSWORD=your_smtp_password
EMAIL_RECIPIENT=your_email_recipient
DEBUG=0
TEST_MODE=0
Basic configuration for scrapers and analyzers:
{
"petaluma": {},
"california": {},
"analyzer": {}
}# Install dependencies
pip install -r requirements.txt
# Run the application
python monitor.py# Build the Docker image
docker build -t events-scraper .
# Run in normal mode
docker run -it --rm --env-file .env events-scraper
# Run in test mode
docker run -it --rm --env-file .env -e TEST_MODE=1 events-scraper# Make the script executable
chmod +x run
# Run the application
./runThe repository includes a standalone script for testing email configuration:
# Test email functionality
python test_email.pyThis sends a simple test email using the configured SMTP settings, which is useful for verifying email connectivity without running the full scraper.
The application is set up to run weekly on Sunday at 2 AM via a cron job:
0 2 * * 0 cd /opt/events-scraper && ./run
- Create a new scraper in the
scrapers/directory, inheriting frombase.py - Implement the
scrape()method - Add the scraper to the
_setup_scrapers()method inmonitor.py
- Check logs at
/var/log/events-scraper.log - For Docker issues, use
docker logs events-scraper - To run in debug mode, set
DEBUG=1in your .env file - For email issues, run
python test_email.pyto test SMTP configuration
MIT