Immediately start with the fact that I do not urge anyone to run out of the Messenger, which can not be called. Quite the contrary. Just sleep is much calmer when one cloud is buried in another cloud. And even the clouds periodically fall on the sinful earth, and losing years of correspondence is very disappointing. Yes, and a friend asked me how to make a backup, but I did not immediately find a clear instruction.
I warn you right away - for backup, you need Linux, or at least a virtual machine with it. If you have hands, you can also on Mac OS, and maybe even on a stub that is now built into Windows - but I do not guarantee anything.
We will be backing up using two cute programs:
We will take the source from trusted sources from the gita, so the first thing you need is a client:
sudo apt install git
Next, create yourself some directory where you will create chaos, for example
mkdir telegram-backup
Then we clone the console client and go to its folder:
git clone --recursive https://github.com/vysheng/tg.git && cd tg
Now we install any dependences for its assembly. If you do not have an ubunt, then alternative assembly methods are described on the program page:
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
Then - classic
./configure make
Now we start the client, the public key transmitted to it as a parameter, which lies right there:
bin/telegram-cli -k tg-server.pub
If everything went well, you will see something like the following:
Telegram-cli version 1.4.1, Copyright © 2013-2015 Vitaly Valtman
Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details typeshow_license'. This is free software, and you are welcome to redistribute it under certain conditions; type
show_license'. This is free software, and you are welcome to redistribute it under certain conditions; type
show_license'. This is free software, and you are welcome to redistribute it under certain conditions; type
show_license 'for details.
Telegram-cli uses libtgl version 2.1.0
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. ( http://www.openssl.org/ )
I: config dir = [/ home / jehy / .telegram-cli]
[/home/jehy/.telegram-cli] created
[/home/jehy/.telegram-cli/downloads] created
Further from the console you will be asked for a phone number, enter it:
phone number: 79166666666
And they will ask for the code that comes in SMS or to another open client, the message from the client looks something like this:
Your login code: 123456
This code can be used to log in to your Telegram account. We never ask it for anything else. Do not give it to anyone !!!
If you didn’t request this, simply ignore this message.
Enter the code:
code ('CALL' for phone code):123456
And enter the password (if you have it installed, which is generally very good):
password :xxx
Further, under a successful set of circumstances, you will see that you have logged into the client and you have started receiving messages:
User Jehy updated flags
User Jehy updated flags
[19:41] Alexander Zharov >>> Hi!
[19:41] Alexander Zharov >>> How are you?
Fine! Now we cut down the client (Ctrl + C) and start it in server mode:
bin/telegram-cli --json -P 9009
After that, we leave this console alone, open the second one, arrive at our telegram-backup daddy and put the second program there:
git clone https://github.com/tvdstaaij/telegram-history-dump.git
Go to its directory
cd telegram-history-backup
And run
ruby telegram-history-dump.rb
If everything is good, then we will see that the backup has started, it will look something like this:
ruby telegram-history-dump.rb
I, [2018-04-26T19: 43: 38.286782 # 11274] INFO -: Attaching to local control: 9009
I, [2018-04-26T19: 43: 39.689541 # 11274] INFO -: Skipping 34 dialogs: "Mila_Milan", "Stormy_Daniels", "Amila_Miley", "Sasha_Gray"
I, [2018-04-26T19: 43: 39.689946 # 11274] INFO -: Backing up 181 dialogs: "user # 1299351", "Canela_Skin", "Dana_DeAmond", "Lita_Phoenix", "Erica_Lauren", "Naomi_Woods", “ Well, you understood "
I, [2018-04-26T19: 43: 39.690609 # 11274] INFO -: Dumping "user # 122679361" (range 1-100)
I, [2018-04-26T19: 43: 40.975234 # 11274] INFO -: Dumping "Jessa_Rhodes" (range 1-100)
I, [2018-04-26T19: 43: 42.262817 # 11274] INFO -: Dumping "Anya_Ivu" (range 1-100)
I, [2018-04-26T19: 43: 43.548510 # 11274] INFO -: Dumping "Brandi_Bae" (range 1-100)
I, [2018-04-26T19: 44: 42.541472 # 11274] INFO -: Dumping Everlasting_Yearning (range 101-200)
I, [2018-04-26T19: 44: 43.541788 # 11274] INFO -: Dumping Infinite_Summer (range 201-300)
I, [2018-04-26T19: 44: 44.542101 # 11274] INFO -: Dumping Infinite_Summer (range 301-400)
I, [2018-04-26T19: 44: 45.542446 # 11274] INFO -: Dumping Infinite_Summer (range 401-500)
Be patient - the telegram has its limits, and therefore the history is not pumped out quickly - about 100 messages from a user or group per second.
When the program finishes its action, an interesting question arises - what exactly and where did we download? To understand this, make the program directory
cd output/json
There will be a bunch of files in JSON format, each of which contains a correspondence with some of the contacts. Of course, it is quite difficult to read, but you can easily export from JSON to any other readable format. By the way, it was still possible to specify a different format when exporting a story — for example, so that you could generate an HTML page per contact.
And if you like hardcore, you can just ruff over the story, like this:
grep "porn" . -R ./.jsonl:{"event":"message","id":"02040050001310087a8e0200000000000000000000000000","flags":228,"from":{"id":"$0120000078745a00625f8a35c922bb6c","p eer_type":"user","peer_id":3328156,"print_name":"Jehy","flags":721597,"first_name":"Jehy","when":"2018-04-26 20:09:54","last_name":"","phone":"7123456 ","username":"Jehy_rus"},"to":{"id":"$02000001005310020000000000000000","peer_type":"chat","peer_id":115391548,"print_name":"","flags":1,"title":" ","admin":{"id":"$01000000001000000000001000000000","peer_type":"user","peer_id":0,"print_name":"user#0"},"members_num":3},"out":true,"unread":false ,"service":false,"date":1504003822,"text":"https://tjournal.ru/58619-polzovatel-reddit-zaarhiviroval-dva-petabayta-porno-chtoby-proverit-bezlimitnoe-oblac hnoe-hranilishche-amazon?from=digest\n\n@navalny ?","media":{"type":"webpage","url":"https://tjournal.ru/58619-polzovatel-reddit-zaarhiviroval-dva-pe tabayta-porno-chtoby-proverit-bezlimitnoe-oblachnoe-hranilishche-amazon?from=digest","title":" Reddit , Amazon","description":" ."}}
Something like that. At the same time I recall:
In general, I slowly have the feeling that soon everything will again be like in the 90s - music, movies and files on local machines, and only programmers can go on the Internet. Not to say that it pleased me.
Source: https://habr.com/ru/post/354472/
All Articles