A personalized news aggregator that scrapes RSS feeds from multiple sources, filters articles using AI based on your interests, and compiles relevant news with summaries and images.
- AI-Powered Filtering: Uses Groq's Llama 3.3 model to intelligently filter articles based on your custom keywords
- Multi-Source Scraping: Aggregates news from:
- Sports (AS.com - Football & Tennis)
- Spanish Politics (20minutos)
- US Politics (NPR)
- Technology & AI (Ars Technica, Wired)
- Image Extraction: Automatically extracts relevant images from RSS feeds
- Smart Deduplication: Filters out tracking pixels and low-quality images
- Secure Configuration: API keys stored safely in environment variables
- Python 3.12 or higher
- Groq API key (free at console.groq.com)
-
Clone the repository
git clone https://github.com/yourusername/NewsScraper.git cd NewsScraper -
Install dependencies
pip install feedparser requests groq python-dotenv
-
Set up environment variables
Create a
.envfile in the project root:GROQ_API_KEY=your_groq_api_key_here
Get your free Groq API key from: https://console.groq.com/keys
Run the news scraper:
python NewsScraper.pyThis will:
- Fetch articles from all configured RSS feeds
- Filter them using AI based on your keywords
- Extract summaries and images
- Display organized results by category
Edit the RSS_FEEDS dictionary in NewsScraper.py:
RSS_FEEDS = {
"deportes": [
"https://feeds.as.com/mrss-s/pages/as/site/as.com/section/futbol/portada/",
],
"politica_es": [
"https://www.20minutos.es/rss/"
],
# Add your own RSS feeds here
}Edit the KEYWORDS dictionary to filter articles based on your interests:
KEYWORDS = {
"deportes": ["real madrid", "alcaraz", "carlos alcaraz"],
"politica": ["elecciones", "gobierno", "trump", "Ukraine"],
"tech": ["ia", "python", "startups", "machine learning"]
}NewsScraper/
├── NewsScraper.py # Main script
├── .env # Environment variables (not committed)
├── .gitignore # Git ignore file
├── README.md # This file
└── test_*.py # Test files (optional)
- RSS Feed Parsing: Uses
feedparserto fetch articles from RSS feeds - AI Filtering: Sends article titles to Groq's Llama 3.3 model with custom prompts
- Image Extraction:
- Different strategies for different sources (AS.com, NPR, Wired, etc.)
- Filters out tracking pixels and invalid images
- Data Aggregation: Collects summaries and images for relevant articles
🤖 Iniciando News Scraper...
============================================================
📰 Obteniendo noticias de DEPORTES...
[['Real Madrid wins La Liga...', 'https://image-url.jpg'], ...]
🇪🇸 Obteniendo noticias de POLÍTICA ESPAÑOLA...
[['Spanish elections update...', 'https://image-url.jpg'], ...]
🇺🇸 Obteniendo noticias de POLÍTICA USA...
[['Epstein files released...', 'https://image-url.jpg'], ...]
💻 Obteniendo noticias de TECH/AI...
[['AI agents breakthrough...', 'https://image-url.jpg'], ...]
============================================================
✅ Scraping completado!
- API keys are stored in
.envfile (never committed to git) .gitignoreprevents sensitive files from being pushed- Environment variables loaded using
python-dotenv
- Web dashboard interface
- Database storage for historical data
- Sentiment analysis
- Article deduplication across sources
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Jaime - GitHub Profile
- RSS feeds provided by AS.com, 20minutos, NPR, Ars Technica, and Wired
- AI filtering powered by Groq
- Built with Python and feedparser