1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-16 14:06:15 +00:00
Go to file
2016-07-07 06:24:07 +02:00
build First commit: Just a collection of library sources from Github. Compiles, but doesn't work. 2016-06-29 10:59:33 +02:00
src/main/java/de/fabianonline/telegram_backup Only run the code in TelegramUpdateHandler if user and db are set. 2016-07-07 06:24:07 +02:00
.gitignore Extended .gitignore. 2016-07-02 19:41:46 +02:00
build.gradle Gradle now creates JAVA files compatible to JAVA 7. 2016-07-05 07:54:35 +02:00
LICENSE.txt The code is now under GPLv3 license. 2016-07-05 14:03:46 +02:00
README.md Added a note on where to find the JAR file to the README. 2016-07-07 06:18:28 +02:00

Telegram_Backup

Copyright 2016 Fabian Schlenz
Licensed under GPLv3

Description

This is a small Java app that allows you to download all your history from Telegram's servers and keep a local copy of them.

Download

You can find the whole app packed into one fat jar file under releases.

Features

  • You can use multiple accounts with this tool.
  • Messages are saved in a SQLite database; media (documents, photos, videos, stickers, geolocations, audios) are downloaded and saved as files.
  • A GUI is planned for later; at the moment this is a command line tool only.
  • Incremental backups - if you run the tool at a later time, it will only download new messages / media.
  • You will be able to use an HTML exporter to create static HTML files containing your chats. This feature is still in the works.

Limitations

This tool relies on Telegram's API. Apparently they don't like people who download lots of media files, so this app gets blocked after about 2000 downloaded media files. This is nothing bad; the app detects this and waits the necessary amount of time as dictated by Telegram. Since this delay can be quite large (I've seen 50 minutes), downloading lots and lots of media can take some time.

But since this tool is designed to be able to continue it's work at any time, you can just abort the download and continue it later - that way, you'll be moving step by step towards a complete archive of your telegram messages and media files.

Usage

You need to have at least Java 1.7 installed on your machine. Download the jar file, and run it on the console like this: java -jar telegram_backup.jar.

Append --help to get a list of all available commands.

Basically, you have to call it with --login first to login to your telegram account and then call it again with --account <phone> to use this account and download all it's history. If you have just one account, you can omit this parameter.

Donations

I've put quite some time into this tool. If you want to donate a small amount, you can send it via Bitcoin to 1CofYzS88iEngxMu4NqQeohWDBUHv9CNDJ or via PayPal to mail@fabianonline.de.

Alternatively use this link the next time you shop at amazon.com or this link for amazon.de. You won't pay any more, but I will get a few percent of your purchase's worth from amazon.

Frequently asked questions

Why do I see error messages?

The library I'm using to access Telegram has some small bugs. One of those is the display of meaningless (because they are being acted accordingly upon) error messages. Those include:

  • Exception in thread "pool-x-thread-y" java.lang.Error: java.nio.channels.ClosedChannelException
  • Something containing AUTH_ERROR You can just ignore these messages.

Basically, if the tool is continuing to run after error messages are shown, you can just ignore the messages. Either way, even if Telegram_Backup would "miss" some files or messages, this will be detected at the next run of this program and then tried again.

Where do you save the files?

The files are being saved in your User directory in a folder named telegram_backup. Under windows, this would typically be under C:\Users\<username>\telegram_backup. Linux users should look unter /home/<username>/telegram_backup.

You can change this directory by supplying --target <dir> when calling Telegram_Backup.

What are those files and folders?

In the folder telegram_backup is one folder named stickers, which will hold all sticker images you've received. Then there is a folder for each account, named after the phone number associated with that account.

In these folders you will find auth.dat and dc.dat, which contain authentication data. There is database.sqlite which is a SQLite3 database containing all your messages and other data. The folder files contains all media files, named after the ID of the message they belong to. Last but not least the folder export contains exported data.

Attribution

This tool uses libraries from other developers which are covered by other licenses, which are:

  • Kotlogram by Yannick Badoual, licensed under MIT License.
  • SQLite JDBC by Taro L. Saito, licensed under Apache License version 2.0.