ScoutBot is a Python-based Telegram bot with modular service-oriented architecture, built for RSS monitoring, video/music downloads, and media processing.
- Python 3.11+ - Core language
- FastAPI - HTTP endpoints and health checks
- aiogram - Telegram Bot API framework
- SQLModel - Database ORM (SQLite)
- APScheduler - Job scheduling
- aiohttp - Async HTTP client
- feedparser - RSS/Atom/JSON Feed parsing
- yt-dlp - Video downloads
- FFmpeg - Media processing
- Redis - Caching (optional)
- Configures logging
- Starts FastAPI server
- Initializes services
- FastAPI endpoints:
/health,/metrics,/stats - Service initialization and lifecycle management
- Job scheduling
- Telegram bot lifecycle
- Command handlers
- Message processing
- SQLite with WAL mode
- Connection pooling
- Models: Feed, Chat, BlockingStats, etc.
- Background job management
- Feed checking (every 10 minutes)
- Statistics monitoring (every 120 minutes)
- Temp file cleanup (every 120 minutes)
RSS Service (app/services/rss_service.py)
- Feed fetching and parsing
- Platform detection (Reddit, YouTube, etc.)
- Cache management
Download Services (app/downloaders/)
- YouTube/Spotify downloads
- Direct file downloads
- Special platforms (Instagram, Pixeldrain, etc.)
Anti-Blocking (app/utils/rate_limiter.py, app/resilience/)
- Rate limiting per domain
- Circuit breakers
- User-agent rotation
- Session management
-
Feed Monitoring:
- Scheduler triggers feed checker
- RSS service fetches and parses feeds
- New items detected and sent to Telegram
-
Downloads:
- User sends download command
- Downloader service processes URL
- File downloaded and uploaded to Telegram
-
Media Processing:
- User sends media command
- FFmpeg processes file
- Result compressed to ZIP and sent
- Modular Design - Services are independent and testable
- Async/Await - Non-blocking I/O operations
- Anti-Blocking - Adaptive rate limiting and circuit breakers
- Caching - Redis for feed responses
- Error Handling - Comprehensive retry logic and resilience
- Resource Optimization - Memory limits, connection pooling, log rotation