This project is a Python script that automatically downloads files from specified Telegram channels. It uses the Telethon library to interact with Telegram's API, allowing users to search for channels by name and download all files posted in those channels to a local directory.
- Download all files from specified Telegram channels.
- Easy configuration via
config.toml
for API credentials and target channels. - Uses async/await for efficient file downloading.
Before you begin, ensure you have met the following requirements:
- Python 3.6 or higher installed on your system.
- A Telegram account and the creation of a Telegram API application for
api_id
andapi_hash
. - Installation of required Python packages:
telethon
,toml
.
To install the required Python packages, run the following command:
pip install -r requirements.txt
- Visit the Telegram API page.
- Log in using your Telegram account.
- Follow the on-screen instructions to register as a developer.
Note: Keep your developer credentials secure and do not share them publicly.
- After registering as a developer, navigate to the API development tools section.
- Click on "Create a new application".
- Fill in the application details:
- App title: [Your application's name]
- Short name: [A shorter version of your application's name, if necessary]
- URL: [Your application's URL, if applicable]
- Platform: [Choose the platform your application will run on]
- Description: [A brief description of your application]
- Agree to the terms and conditions and click "Create Application".
After creating your application, you will be presented with your API keys:
- App ID: A unique identifier for your application.
- API Hash: A hash key required for API access.
Important: Keep these keys confidential as they are essential for interacting with the Telegram API.
- Rename
config.example.toml
toconfig.toml
. - Fill in your
api_id
,api_hash
,phone
, and desiredtarget_channel_names
anddownload_directory
inconfig.toml
.
Example config/config.toml
:
phone = "+1234567890"
api_id = "123456"
api_hash = "abcdef1234567890abcdef987654321"
target_channel_names = ["Example Channel 1", "Example Channel 2"]
download_directory = "Downloaded_Files"
filter_extensions = [".zip"]
num_threads = 3
To run the script, navigate to the script's directory in your terminal and execute:
python app.py
Follow any on-screen instructions to authenticate with Telegram if required.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- 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
Distributed under the MIT License. See LICENSE
for more information.
Tuan Ha Anh - [email protected]
Project Link: https://github.com/tuanha1305/telegram-download-channel.git