A powerful application to download multiple videos and files from Telegram channels, groups, and chats. This tool supports various URL formats and provides both command-line and graphical user interfaces.
- Multiple Interface Options: Command-line, GUI, and direct download script
- Smart URL Handling: Support for various URL formats including:
- Channel usernames (e.g.,
channelname) - Channel IDs (e.g.,
-2570734937) - t.me links (e.g.,
https://t.me/channelname) - Web client URLs (e.g.,
https://web.telegram.org/k/#-2570734937)
- Channel usernames (e.g.,
- Flexible File Filtering: Download specific file types (videos, photos, documents, etc.)
- Progress Tracking: Real-time download progress with progress bars
- Batch Processing: Download multiple files in one go
- Customizable Download Location: Choose where to save your files
- Detailed Logging: Comprehensive logs for troubleshooting
- Python 3.7 or higher
- Telegram API credentials (API ID and API Hash)
-
Clone this repository:
git clone <repository-url> cd telegramvideodownloader
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the root directory with your Telegram API credentials:API_ID=your_api_id API_HASH=your_api_hashYou can copy the
.env.examplefile and fill in your details.
- Visit https://my.telegram.org/auth
- Log in with your phone number
- Click on "API development tools"
- Create a new application
- Copy the API ID and API Hash
Run the command-line version with:
python downloader.pyFollow the prompts to:
- Enter the Telegram channel username or URL
- Specify which file types to download (videos, photos, documents, etc.)
- Set the download location
- Limit the number of messages to scan (optional)
Run the GUI version with:
python gui_downloader.pyThe graphical interface will:
- Allow you to enter your API credentials (or load them from .env)
- Let you browse for a download folder
- Enter channel details and file type filters
- Show download progress with a progress bar
- Display logs of the download process
For automated or scripted downloads:
python direct_download.py [channel] --types [file_types] --folder [download_folder] --limit [message_limit]Example:
python direct_download.py -2570734937 --types video,photo --folder my_downloads --limit 100If you encounter problems accessing a channel:
- Make sure you're a member of the channel/group you're trying to download from
- Try using different channel identifier formats (username, ID, or URL)
- Check the logs for detailed error messages
When filtering by file type:
- For videos, use
videoas the file type - For photos, use
photo - For documents, you can specify the extension (e.g.,
pdf,doc,mp3) - Leave empty to download all file types
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.