A modern web application for cloning Telegram channels with an intuitive interface and real-time progress tracking.
- User-friendly Interface: Clean, modern dark-mode design
- Telegram Authentication: Secure login with phone number and 2FA support
- Channel Selection: Browse and select from your available channels
- Smart Cloning: Clone to new channels or existing ones
- Real-time Progress: Live status updates during cloning process
- Media Support: Preserves text formatting, images, videos, and documents
- Rate Limiting: Built-in delays to avoid Telegram restrictions
- Error Handling: Robust error management with user feedback
- Python 3.11 or higher
- Telegram API credentials (API ID and API Hash)
- A Telegram account
-
Clone the repository
git clone https://github.com/DevHuney/tg-cloner cd tg-cloner -
Create a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.envfile in the project root:API_ID=your_telegram_api_id API_HASH=your_telegram_api_hash SESSION_STRING= # Will be generated during first login
To get your API credentials:
- Go to my.telegram.org
- Log in with your phone number
- Go to "API Development Tools"
- Create a new application to get API_ID and API_HASH
-
Start the application
uvicorn main:app
-
Open your browser
Navigate to
http://localhost:8000 -
First-time setup
- Enter your phone number in international format (+1234567890)
- Enter the verification code sent to your Telegram
- If you have 2FA enabled, enter your password
-
Clone channels
- Select a source channel from your list
- Choose to create a new channel or select an existing destination
- Click "Start Cloning" and monitor the real-time progress
- Authentication: Uses Telethon library to authenticate with Telegram
- Channel Discovery: Fetches all channels you're a member of
- Message Processing: Iterates through messages in batches of 10
- Content Preservation: Maintains original formatting, media, and structure
- Progress Tracking: Updates status in real-time via JSON file
- Rate Limiting: Random delays (1-5 seconds) between messages to avoid restrictions
- Session strings are stored locally in
.env - No passwords or sensitive data stored in plain text
- Automatic session management and cleanup
- Error handling prevents data leaks
- Backend: FastAPI, Python
- Frontend: HTML5, CSS3, JavaScript (Vanilla)
- Telegram API: Telethon library
- Styling: Custom CSS with modern dark theme
- Real-time Updates: Polling-based status checking
tg-cloner/
├── main.py # FastAPI application and core logic
├── requirements.txt # Python dependencies
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
├── templates/ # HTML templates
│ ├── signup.html # Authentication page
│ ├── home.html # Channel selection and cloning setup
│ └── cloning.html # Real-time progress page
└── README.md # This file
GET /- Root redirect to appropriate pageGET /home- Main application pageGET /signup- Authentication pageGET /cloning- Progress monitoring pagePOST /api/signup/tglogin/number- Send verification codePOST /api/signup/tglogin/code- Verify codePOST /api/signup/tglogin/pwd- Two-factor authenticationGET /api/tginfo- Get user channels and cloning statusPOST /api/start- Start cloning processGET /api/cloning_status- Get real-time cloning progress
Common Issues:
- "User not authorized": Re-authenticate through
/signup - Rate limiting errors: The app handles these automatically with delays
- Session expired: Delete the
SESSION_STRINGfrom.envand re-login - No channels showing: Ensure you're a member of at least one channel
Development Mode:
uvicorn main:app --reload --log-level debug- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is for educational purposes. Please respect Telegram's Terms of Service and use responsibly.
This tool is designed for legitimate use cases such as backing up your own channels or migrating content you own. Always ensure you have proper permissions before cloning any channel content.