TeSo is a Telegram message scraping and search engine that allows you to collect and analyze messages from Telegram channels using both user-bot and bot interfaces.
- Automated message scraping from Telegram channels
- PostgreSQL database integration for message storage
- Configurable batch processing with rate limiting
- Search functionality through a Telegram bot interface
- Docker support for easy database setup
- Python 3.8 or higher
- Poetry for dependency management
- Docker (optional, for local database setup)
- Telegram account and bot token
- Clone the repository
- Install dependencies using Poetry:
poetry install- Create a
.envfile in the project root with the following variables:
API_ID=your_api_id # Telegram API ID
API_HASH=your_api_hash # Telegram API Hash
PHONE=your_phone_number # Phone number for user-bot
DATABASE_URL=postgresql_url # PostgreSQL connection URL
TELEGRAM_BOT_TOKEN=bot_token # Telegram Bot Token- API_ID and API_HASH: Get from my.telegram.org/apps
- TELEGRAM_BOT_TOKEN: Create a new bot through @BotFather
- DATABASE_URL format:
postgresql://user:password@localhost:5432/dbname
If using Docker for local development:
docker compose up -dpoetry shellpython teso.engineCurrent settings (configurable in code):
batch_size = 50 # Messages per batch
batch_delay = 2 # Seconds between batches
channel_delay = 30 # Seconds between channels
max_attempts = 3 # Retry attemptspython -m teso.botpython -m teso.search- Full-text search across scraped messages
- Channel-specific filtering
- Date range filtering
- Customizable result limits
The scraper implements rate limiting to avoid Telegram's FloodWaitError:
- Batch processing with configurable delays
- Automatic retry mechanism
- Channel-specific delays
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions and support, please open an issue in the GitHub repository.
Note: This project is under active development. Features and documentation may change.