A comprehensive Python-based system that automatically scrapes football news from multiple sources, processes content with AI, and posts to Telegram channels.
🚀 Multi-Source News Scraping
- Goal.com, BBC Sport, Marca, ESPN FC, Sky Sports, The Guardian, AS.com, L'Equipe
- Robust CSS selectors with fallback mechanisms
- Intelligent duplicate detection
🤖 AI-Powered Content Processing
- Google Gemini integration for content summarization
- Automatic sentiment analysis
- Smart content enhancement
📱 Telegram Integration
- Automated posting to Telegram channels
- Image support with base64 encoding
- Caption length optimization
🔥 Firebase Backend
- Real-time Firestore database
- Timestamp tracking for efficient scraping
- Scalable cloud architecture
⏰ Intelligent Scheduling
- APScheduler for automated execution
- Configurable intervals
- Graceful error handling and logging
- Python 3.8+
- Google Firebase project
- Telegram Bot Token
- Google Gemini API key
-
Clone the repository
git clone https://github.com/mociatto/FootFa.git cd FootFa -
Create virtual environment
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Setup Firebase
- Create a Firebase project at console.firebase.google.com
- Enable Firestore Database
- Create a service account and download the JSON key
- Save it as
service-account-key.jsonin the project root
-
Configure API Keys
Edit
config.pywith your credentials:# Firebase FIREBASE_SERVICE_ACCOUNT_PATH = "service-account-key.json" # Telegram TELEGRAM_BOT_TOKEN = "your_telegram_bot_token" TELEGRAM_CHANNEL_ID = "@your_channel_username" # Google Gemini AI GEMINI_API_KEY = "your_gemini_api_key"
-
Create Firestore Index
Run the system once to get the index creation URL:
python3 main.py
Click the provided Firebase console link to create the required composite index.
Run once:
python3 main.pyTest individual components:
# Test website scraping
python3 website_scraper.py
# Test Telegram posting
python3 telegram_poster.py
# Test AI processing
python3 ai_processor.py
# Test Firestore operations
python3 firestore_manager.pyFootFa/
├── main.py # Main scheduler application
├── website_scraper.py # Multi-site news scraping
├── firestore_manager.py # Database operations
├── ai_processor.py # Content AI processing
├── telegram_poster.py # Telegram posting
├── image_finder.py # Image search and processing
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore patterns
└── README.md # This file
- Goal.com - International football news
- BBC Sport Football - Premier League and international
- Marca - Spanish football focus
- ESPN FC - American sports perspective
- Sky Sports Football - British coverage
- The Guardian Football - In-depth analysis
- AS.com - Spanish and international
- L'Equipe - French football coverage
Default: Every 30 minutes
Configure in config.py:
NEWS_FETCH_INTERVAL_MINUTES = 30- Automatic summarization
- Duplicate detection
- Sentiment analysis
- Image optimization
- Caption formatting
- Create project at Firebase Console
- Enable Firestore Database
- Create service account key
- Message @BotFather on Telegram
- Create new bot with
/newbot - Get your bot token
- Add bot to your channel as administrator
- Visit Google AI Studio
- Create API key
- Add to config.py
source .venv/bin/activate
python3 main.py- Deploy to cloud services (AWS, GCP, Azure)
- Use process managers (PM2, systemd)
- Set up monitoring and logging
- Configure environment variables
Import Errors
pip install -r requirements.txtFirebase Permission Errors
- Verify service account key path
- Check Firestore security rules
Telegram API Errors
- Verify bot token
- Ensure bot is channel administrator
- Check channel username format (@channel_name)
Website Scraping Issues
- Sites may change their HTML structure
- CSS selectors in
website_scraper.pymay need updates - Some sites implement anti-scraping measures
The system provides comprehensive logging:
- Import/execution errors
- API responses
- Database operations
- Scheduling events
- Fork the repository
- Create feature branch (
git checkout -b feature/new-feature) - Commit changes (
git commit -am 'Add new feature') - Push to branch (
git push origin feature/new-feature) - Create Pull Request
This project is for educational and personal use. Please respect the terms of service of all integrated APIs and websites.
For issues and questions:
- Check existing GitHub issues
- Create new issue with detailed description
- Include error logs and configuration (remove sensitive data)
⚽ Happy Football News Automation! ⚽