Telegram Channel Downloader is a Node.js application that allows users to download media files and messages in HTML and JSON formats from Telegram channels, groups, or users. This tool simplifies the process of archiving content from Telegram for offline viewing or storage.
Support the project by buying me a coffee! Every contribution helps keep the project running.
To use the Telegram Channel Downloader, follow these steps:
- Create a Telegram App: Go to https://my.telegram.org/apps and create a new application.
- Get API Credentials: After creating the app, copy the API ID and API Hash provided by Telegram.
-
In the root directory of the application, create a file named
config.json
and paste the following code:{ "apiId": "YOUR_API_ID", "apiHash": "YOUR_API_HASH", "sessionId": "" }
Replace
YOUR_API_ID
andYOUR_API_HASH
with the values obtained in step 2. Keep thesessionId
blank for now; it will be updated automatically after logging in for the first time.
Once the setup is complete, you can start using the Telegram Channel Downloader:
-
Install all dependencies using:
npm install
-
Run the Script: Open your terminal or command prompt and navigate to the directory where the Telegram Channel Downloader is located. Run the following command to start the script:
npm start
-
Login: The script will prompt you to enter your phone number and the code sent to your phone or Telegram account. This authentication is required only the first time you run the script.
-
Select Chat/Channel/Group: After logging in, choose the target chat, channel, or group you want to scrape. Use the arrow keys to move and select the target chat.
-
Wait for Download: The script will start downloading all available media files and messages from the specified channel, group, or user. Depending on the size of the content, this process may take some time.
-
Access Downloaded Files: Once the download is complete, you can find the downloaded media files and messages in the
export/
directory within the Telegram Channel Downloader directory.
Available Commands
Script Name | Description |
---|---|
listen-channel |
Listen to a channel and download media from incoming messages |
download-selected-message |
Download media from selected messages |
download-channel |
Download all media from a channel |
Using CLI Commands
node cli [script-name] --options
example node cli listen-channel --channelId=12345
- Session Handling: The
sessionId
field in theconfig.json
file will be automatically updated after logging in for the first time. This session ID is used for subsequent logins to avoid re-entering your credentials. - Media Types: The Telegram Channel Downloader supports downloading various types of media files, including images, videos, audio files, documents, and other attachments shared within the specified channel, group, or user.
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
Happy coding