tg-archive is a tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives.
The @fossunited Telegram group archive.
tg-archive uses the Telethon Telegram API client to periodically sync messages from a group to a local SQLite database (file), downloading only new messages since the last sync. It then generates a static archive website of messages to be published anywhere.
pip3 install tg-archive
(tested with Python 3.8.6).tg-archive --new --path=mysite
(creates a new site. cd
into mysite and edit config.yaml
).tg-archive --sync
(syncs data into data.sqlite
).
Note: First time connection will prompt for your phone number + a Telegram auth code sent to the app. On successful auth, a session.session
file is created. DO NOT SHARE this session file publicly as it contains the API autorization for your account.tg-archive --build
(builds the static site into the site
directory, which can be published)Edit the generated template.html
and static assets in the ./static
directory to customize the site.
Licensed under the MIT license.