tgautodown is an automatic download tool based on Telegram MTProto. It does not rely on the Bot API and does not require a separate deployment of bot-api-server. After logging in with your own Telegram account, it can monitor specified channels or groups and automatically save received videos, music, images, documents, magnet links, and notes to a local directory.
It is suitable for scenarios such as creating your own private channel, forwarding resources you need to save into it, and then letting tgautodown automatically download and archive them.
Main Features
- Supports downloading videos, music, images, and documents.
- Supports saving text notes.
- Supports magnet link downloads.
- Supports retrieving original Telegram file names.
- Supports logging into Telegram via a web page.
- After successful login, the web page displays the progress of ongoing download tasks, without showing sensitive information like AppHash or phone number.
- Each download task is assigned a temporary UID, which can be used to pause, resume, or delete tasks within Telegram.
- Docker Compose supports ARM64 and AMD64 architectures.
How to Fill in Channel Parameters
The -names in the startup parameters or the Docker environment variable TG_CHANNEL are used to configure the monitoring source.
For public channels or public groups, simply fill in the username, for example:
my_public_channel
For private channels or private groups, fill in the +hash from the invitation link. For example, if the invitation link is:
https://t.me/+AjbQIYhiKlhhNzMx
Then configure it as:
+AjbQIYhiKlhhNzMx
Note: This is not the channel ID. The current version does not support directly entering the channel ID.
If the account has not yet joined this private channel, the program will attempt to join automatically via the invitation link. A more reliable method is to first log in with the same account using the official Telegram client, manually join the channel or group, and then start the program.
Docker Compose Startup
First, pull the project to your server:
git clone https://github.com/Suk-ldev/tgautodown.git
cd tgautodown
The project already provides a docker-compose.yml file. Open it first:
nano docker-compose.yml
You mainly need to modify these parts:
environment:
TG_CHANNEL: "+AjbQIYhiKlhhNzMx"
TG_PROXY: "socks5://192.168.31.2:7891"
TG_F2A: ""
TG_RETRYCNT: "10"
ports:
- "2020:2020"
volumes:
- "/mnt/sda1/download:/app/download"
- "/mnt/sda1/data:/app/data"
Explanation:
TG_CHANNELis the monitoring source. For public channels, fill in the username; for private channels, fill in the+hashfrom the invitation link.TG_PROXYis the socks5 proxy. If the server can directly access Telegram, change it to"".TG_F2Ais the Telegram two-factor authentication password. Leave it empty if two-factor authentication is not enabled.TG_RETRYCNTis the number of retries after a download failure, generally keep it at10.
ports on the left are host ports, and on the right are container ports. The default access is http://Server IP:2020.volumes on the left are server directories, and on the right are container directories. Usually, only modify the left side, for example, change it to your own hard drive mount directory.Complete example:
services:
tgautodown:
image: tgautodown:${TARGETARCH:-arm64}
build:
context: .
dockerfile: Dockerfile
args:
TARGETOS: linux
TARGETARCH: ${TARGETARCH:-arm64}
platform: linux/${TARGETARCH:-arm64}
container_name: tgautodown
restart: unless-stopped
environment:
TG_CHANNEL: "+AjbQIYhiKlhhNzMx"
TG_PROXY: ""
TG_F2A: ""
TG_RETRYCNT: "10"
ports:
- "2020:2020"
volumes:
- "/root/download:/app/download"
- "/root/data:/app/data"Save and start:
docker compose up -d --buildARM64 machines can build directly:
docker compose up -d --buildFor AMD64:
TARGETARCH=amd64 docker compose up -d --buildForce rebuild the image:
docker compose down --rmi local
docker compose build --no-cache --pull
docker compose up -d --force-recreateFirst Login
After the container starts, open:
http://Server IP:2020Enter your Telegram API App ID, App Hash, and phone number, wait for the verification code, and then submit the verification code on the page. After successful login, the page will enter the download progress view.
You can apply for Telegram API ID and App Hash here:
https://core.telegram.org/api/obtaining_api_idDownload Directory
Resources will be saved by type:
videos Videos
music Music
documents Documents
photos Photos
bt Magnet links
note Text notesIf you map /app/download in Docker to a host directory, for example, /mnt/sda1/download, then the final files will appear in the corresponding category directories on the host.
Pause, Resume, and Delete Downloads
After the task starts, the program will reply with a prompt like this in Telegram:
Downloading video: example.mp4
- UID: 100
- File size: 1.20GB
- Message ID: 123
- To pause, enter: pause 100
- To delete the video being downloaded, enter: delete 100
- To resume, enter: resume 100You can then send the following in the monitored channel or group:
pause 100
resume 100
delete 100The UID is temporary and will be released after the download is complete, failed, or deleted.
About FLOOD_WAIT
If you see the following in the logs:
FLOOD_WAIT (2452)This means Telegram is limiting the account from making further requests. You need to wait for the number of seconds in parentheses. For example, 2452 seconds is approximately 40 minutes and 52 seconds.
If you encounter this situation, do not repeatedly restart the container, nor repeatedly try the same invitation link. Start it again after the restriction period has passed, or manually join the channel using the official Telegram client first, and then let the program listen.
View Logs
docker compose logs -f --tail=100 tgautodownIf you see ready, it means the Telegram account has been logged in successfully. If you see private channel or public channel, it means the channel has been recognized and is starting to be monitored.
Summary
tgautodown is more like a private Telegram resource archiver: forward resources to a fixed channel, and it is responsible for downloading, classifying, and saving them. Deployed with Docker on a NAS, soft router, or ARM mini-host, it can basically run in the background long-term.