TeleGrab: The Ultimate Telegram Channel & Group Archiver. Designed to grab every photo, video, and document, bypassing API limits and handling expired links with ease.
- Robust Parallel Downloads: Stably download from multiple workers at once without errors.
- Smart Error Handling: Automatically handles
FloodWait
andFile reference expired
errors. - Chunk-Based Throttling: Downloads files in small chunks with configurable delays to avoid API bans.
- Intelligent State Management: Never lose progress. Accurately resumes from the last fully downloaded file.
- Automatic Cleanup: Removes empty files from failed downloads.
- Human-like Behavior: Staggered downloads and other techniques to mimic a human user.
- Account Type Support: Optimized settings for both free and premium accounts.
- Concurrent Downloads: Download multiple files simultaneously.
- Password Protection: Support for password-protected channels.
- CSV Export: Export download reports to CSV format.
- State Encryption: Secure state file encryption for privacy.
- Duplicate File Handling: Overwrite or create unique names for existing files.
- Python 3.8 or higher
- Telegram account (free or premium)
- API credentials from my.telegram.org
- Clone or download the project:
git clone https://github.com/1BitCode-Com/telegrab.git
cd telegrab
- Install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- Run the interactive setup:
source .venv/bin/activate
python3 run.py
Edit config.json
to customize settings. Here is a full example:
{
"api_id": "YOUR_API_ID",
"api_hash": "YOUR_API_HASH",
"session_name": "telegrab_session",
"target_group": "https://t.me/example_channel",
"download_dir": "downloads",
"account_type": "premium",
"rate_limit_delay": 5,
"chunk_size_kb": 256,
"chunk_delay_ms": 200,
"overwrite_existing_files": false,
"user_agents_enabled": true,
"free_settings": {
"max_concurrent": 1,
"delay_between_batches": 15,
"batch_size": 5
},
"premium_settings": {
"max_concurrent": 10,
"delay_between_batches": 10,
"batch_size": 20
}
}
account_type
: Set to"premium"
or"free"
to use the corresponding settings block.max_concurrent
: The number of files to download in parallel.chunk_size_kb
: The size of each file piece to download (e.g., 256KB).chunk_delay_ms
: The delay in milliseconds after downloading each chunk (e.g., 200ms). This is critical for avoiding bans.
# Use target and settings from config.json
python3 telegrab.py
# Override target from command line
python3 telegrab.py --target "https://t.me/channel_name"
# Override account type
python3 telegrab.py --account-type "free"
# Override concurrent downloads
python3 telegrab.py --max-concurrent 1
# Overwrite existing files
python3 telegrab.py --overwrite
# Password protected channel
python3 telegrab.py --password "channel_password" --target "https://t.me/private_channel"
# Start interactive setup
python3 run.py
Problem: Telegram is rate-limiting your requests because they are too fast or aggressive. Solution:
- Increase
chunk_delay_ms
: This is the most effective solution. Try values like500
or1000
. - Reduce
max_concurrent
: Lower the number of parallel downloads. - Increase
delay_between_batches
: Slows down how fast the script iterates through messages.
Problem: The temporary download link expired before the download could start. Solution: This is automatically handled by the script in v2.0.0+. If you see this, ensure you are on the latest version.
Problem: Network connectivity problems. Solution:
- Check internet connection
- Verify API credentials
- Try a different
session_name
inconfig.json
telegrab/
├── telegrab.py # Main script
├── run.py # Interactive runner
├── config.json # Configuration
├── requirements.txt # Dependencies
├── logs/ # Log files
└── downloads/ # Downloaded files
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
# Run tests
python3 test_downloader.py
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub Issues: Report bugs and request features
- Documentation: Check QUICK_START.md for detailed guide
- Security: Report security issues privately
See CHANGELOG.md for a complete list of changes and updates.
Made with ❤️ by 1BitCode-Com
