A Python program that scans websites for changes and uses LLMs (via Groq API) to intelligently summarize what has been updated. Perfect for tracking class websites, webcomics, job boards, or any content that updates regularly.
- Python 3.7+
- Groq API key (free tier is sufficient)
- Internet connection
-
Clone or download the files:
website_monitor.py- Main programrequirements.txt- Python dependenciessetup.sh- Setup script
-
Run the setup script:
chmod +x setup.sh ./setup.sh
-
Get your Groq API key:
- Visit: https://console.groq.com/
- Create an account and generate an API key
- Set the environment variable:
export GROQ_API_KEY=your_api_key_here
-
Create virtual environment:
python3 -m venv venv source venv/bin/activate # I used linux... for Windows, do: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Edit the websites list in website_monitor.py:
websites = [
"https://news.ycombinator.com",
"https://www.python.org/jobs/",
"https://github.com/trending",
# Add more URLs here
]The program supports several open-source models via Groq:
llama3-8b-8192- Fast, efficient (default)llama3-70b-8192- More powerful, slowermixtral-8x7b-32768- Good balance of speed/qualitygemma-7b-it- Google's model
# First run - establishes baseline for all websites
python website_monitor.py
# Subsequent runs - detects and reports changes
python website_monitor.py# Use a different model
python website_monitor.py --model llama3-70b-8192
# Store data in custom directory
python website_monitor.py --data-dir ./my_monitoring_data
# See all options
python website_monitor.py --helpWebsite Update Monitor
Monitoring 3 website(s)...
Using model: llama3-8b-8192
Data directory: website_data
--------------------------------------------------
Monitoring Results:
- Hacker News: No updates detected
- Python Job Board: 3 new job postings for Python developers added
- Baseline Establishment: Visits each website in your list
- Content Extraction: Downloads and extracts main text content using BeautifulSoup
- Storage: Saves content and metadata to local JSON file
- Output: Reports that baseline has been established for each site
- Content Fetching: Downloads current version of each website
- Change Detection: Compares MD5 hash of current content vs. stored content
- AI Analysis: For changed sites, sends old and new content to Groq LLM for analysis
- Summary Generation: AI generates concise bullet-point summary of changes
- Update Storage: Saves new content for future comparisons
├── website_monitor.py # Main program
├── requirements.txt # Python dependencies
├── setup.sh # Setup script
├── website_data/ # Storage directory (created automatically)
│ └── website_storage.json # Website content and metadata
└── venv/ # Virtual environment (created by setup)
"GROQ_API_KEY environment variable not set"
- Get API key from https://console.groq.com/
- Set it:
export GROQ_API_KEY=your_key_here - For permanent setup, add to your
.bashrcor.zshrc
"Failed to fetch content"
- Check internet connection
- Some sites may block automated requests
- Try adding different user agents or request delays
"AI comparison failed"
- Check Groq API key is valid
- Verify you have API quota remaining
- Content might be too large (automatically truncated)
No changes detected when you expect them
- Site might use dynamic content loading (JavaScript)
- Check if the meaningful content is in the extracted text
- Consider monitoring a more specific URL
Groq offers generous free tiers:
- Free tier includes significant monthly quota (1,000 requests per day)
- Cost-effective pricing for additional usage
- Open-source models (Llama 3, Mixtral, Gemma)
- Much faster than traditional APIs
- Start Small: Begin with 1-2 websites to test
- Respectful Monitoring: Don't check too frequently (avoid being blocked). I run this script at most twice per day.
- Specific URLs: Monitor specific pages rather than homepages for better results
- API Key Security: Keep your API key private and secure
- Regular Cleanup: Periodically review and clean up stored data