A Python tool for saving and analyzing Telegram channel content, including messages, users, and media.
- Save channel messages with reactions and media information
- Track channel users and their activity
- Search through saved messages
- Support for multiple Telegram accounts
- Message download with rate limiting and error handling
- Detailed statistics about saved content
Created by Sergey Bulaev - Follow my Telegram channel about AI and technology for more projects and updates.
- Clone the repository:
git clone https://github.com/chubajs/telegram-channel-saver.git cd telegram-channel-saver ```
- Create and activate virtual environment:
# On Windows python -m venv venv venv\Scripts\activate # On macOS/Linux python3 -m venv venv source venv/bin/activate ```
- Install required dependencies:
pip install -r requirements.txt ```
- Get your Telegram API credentials:
- Go to https://my.telegram.org/apps
- Create a new application
- Note your
api_id
andapi_hash
- set API_ID=your_api_id
- set API_HASH=your_api_hash
- export API_ID='your_api_id'
- export API_HASH='your_api_hash'
+5. Create a
.env
file in the project root directory:
-
- API_ID=your_api_id # numbers only, no quotes
- API_HASH=your_api_hash # string, no quotes
-
-
Run the application:
python saver.py ```
-
First-time setup:
- Enter your phone number in international format
- Enter the verification code sent to your Telegram
- If you have 2FA enabled, enter your password
-
Main features:
- List and select channels/groups
- Save channel messages and users
- Search through saved content
- View statistics and user information
- Manage multiple Telegram sessions
- Download new messages only
- Force redownload all messages
- Set custom message limits
- Automatic rate limiting to avoid API restrictions
- Search by text content
- Search by date range
- Search by message ID
- Filter messages with reactions
- Filter messages with media
- View user's last messages
All data is stored locally in JSON format:
- Messages and reactions
- User information
- Channel/group details
- Session data
Data location: temp/channel_saver/database.json
Default settings (can be modified in saver.py
):
MESSAGES_BATCH_SIZE = 100
- Messages per batchBATCH_DELAY = 2
- Delay between batches (seconds)SAVE_INTERVAL = 300
- Database save interval (seconds)MAX_RETRIES = 3
- Maximum retry attempts
- Automatic retry on failed requests
- Session management and recovery
- Corrupted database detection
- Rate limit compliance
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This tool is for educational purposes only. Make sure to comply with Telegram's Terms of Service and API usage guidelines when using this application.
If you encounter any issues or have questions, please open an issue in the GitHub repository.
Common issues:
- API Credentials Error: Make sure your
.env
file exists and contains valid API credentials - Database Errors: Check if the temp directory has proper write permissions
- Rate Limiting: If you encounter frequent rate limits, try increasing
BATCH_DELAY