3.6 KiB
Telegram Group Backup
Author https://t.me/chavespatriota, ID Telegram 1670082376, 03-19-2021, owner of https://t.me/canaisfascistasbr channel. Program based on Linux. On Windows you may need to specify the path to use the python3.exe
program. Below is an example of how the execution of the program looks in this case.
"c:\users\your_name\appdata\local\programs\python\python39\python3.exe" program_get_data.py
This program make backup of Telegam groups. It forward messages and scrap groups. It is similar to https://git.teknik.io/egonalbrecht/backup_channel_telegram, but focus in gropus. This program already comes on Linux and is very simple to use. In the video tutorial you have an example of using this porgram. In the following address has an explanation of how to use it: https://www.youtube.com/watch?v=QZJ1drMQz1A. Telegram does not let you send media indefinitely, it simply break, but it just decreases the interval between regular backups to solve this. Scraping groups is very slow, unfortunately.
Manual about how to use the program for channel backup
1. Register at https://my.telegram.org/apps: To use the program, you must first register at https://my.telegram.org/apps. This site allows you to use Telegram remotely, without the need for an interface. You will receive a code on your cell phone on Telegram. During the registration process, enter anything in the name and title field, with at least 8 letters. Select "Desktop". Once registered you will get 2 codes called api_ip
and api_hash
. SAVE THIS 2 CODES, as you will need it. It is suggested that you save to Telegram even in 'Saved Messages'.
2. Group Backup: First you will put your api_id
and api_hash
data in the file with the name api_id and api_hash.txt
in the Files and Settings
folder. Just replace the ?????????
by their api_id
and api_hash
numbers. After putting these two data to make remote access, go to the file Files and Settings/Backup channels.txt
and put the username of the channel to backup and the backup channel, separated by comma. When you run the program for the first time, Telegram will ask you for personal data. You will receive a code on your Telegram on your cell phone, use it in the program. You will be asked for your Telegram password. Go to the Telegram settings and create one, if you haven't already. During the execution of the program you will be asked to install additional packages. Install it as the command pip3 install
. Surely it had asked you to install the telethon package, as shown below.
pip3 install telethon
To run the program, use the command below.
python3 program_backup_group_telegram.py
To run the program regularly, which is very important, you must use the crontab
program, as spoken above. The use of crontab
is indispensable because the main purpose of the program is to make backups regularly. For example, to make backups of your channels every day at midnight, you must include a command similar to this
0 0 * * * cd /home/path_to_program_directory/ && python3 program_backup_group_telegram.py
Which means it will run the program every day at night, at 0 minute of 0 hour (24 hours). If you want to run the backup every 6 hours, you must include this command
0 */6 * * * cd /home/path_to_program_directory/ && python3 program_backup_group_telegram.py
which means that the backup will run at 0 minutes every 6 hours, or more specifically, the program will run at 0 minutes at 0, 6, 12 and 18 hours, that is, 4 times a day.
To restart the backup, delete the ID files inside the Files and Settings/ID Saved Messages
.