/rim/ noun
a large quantity of written matter
ream
is a tool that lets you easily export all of your important Telegram
chats.
It is a standalone re-implementation of Telegram Desktop's export
functionality. The output from ream
must be fully equivalent to the
output from Telgram Desktop, and any difference in the resulting json (except
for filenames) is treated as a bug.
Warning
ream
is only meant to be used for downloading private chats.
Using it to export channels or groups may produce incomplete output or even get your account rate-limited.
- Install Poetry
- Clone this repository
- Run
poetry install
to get the dependencies
First, you have to follow this instruction to obtain Telegram API credentials.
To run ream
, you must create a configuration file named ream.toml
with
the following contents:
[api] # Your API credentials
app_id = 123456
app_hash = "abcdefg01234"
[export]
max_file_size = 5000000000 # Max size for files to be downloaded
chats = [ 123456, 7891234 ] # A list of chat ids to download
path = "exports" # A directory in which your chat exports will be saved
[ream]
log_level = "ERROR" # Optional: log level for the application, defaults to INFO
poetry run ream.py
The first time you run the program, It'll ask you to enter your phone number and login code.
ream
may throw an error after you log in. If that happens, you need to
confirm the data export request that you got on your Telgram account, and try
running ream
again.
Incremental exports are supported, which means that ream
will only export
messages that aren't already present in the export.json
file for a given
chat. You can run ream
as a scheduled job without having to deal with
duplicate data.