knadh/tg-archive
소개
텔레그램 그룹 채팅을 메일링 리스트 아카이브와 같은 정적 웹사이트로 내보내는 도구입니다.
웹 및 앱 개발What you can do
- Periodically sync Telegram group messages to a local DB.
- Download user avatars locally.
- Download and embed media (files, documents, photos).
- Renders poll results.
측정된 스타 증가
- in 24h
- +3
- in 7 days
- +2
- in 15 days
- +2
- in 1 month
- +3
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
tg-archive is a tool for exporting Telegram group chats into static websites, preserving chat history like mailing list archives.
IMPORTANT: I'm no longer actively maintaining or developing this tool. Can review and merge PRs (as long as they're not massive and are clearly documented).
Preview
The @fossunited Telegram group archive.

How it works
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.
Features
- Periodically sync Telegram group messages to a local DB.
- Download user avatars locally.
- Download and embed media (files, documents, photos).
- Renders poll results.
- Use emoji alternatives in place of stickers.
- Single file Jinja HTML template for generating the static site.
- Year / Month / Day indexes with deep linking across pages.
- "In reply to" on replies with links to parent messages across pages.
- RSS / Atom feed of recent messages.
Install
Get Telegram API credentials. Normal user account API and not the Bot API.
- If this page produces an alert stating only "ERROR", disconnect from any proxy/vpn and try again in a different browser.
Install with:
uv pip install tg-archive(tested with Python 3.13.2).
Usage
tg-archive --new --path=mysite(creates a new site.cdinto mysite and editconfig.yaml).tg-archive --sync(syncs data intodata.sqlite). Note: First time connection will prompt for your phone number + a Telegram auth code sent to the app. On successful auth, asession.sessionfile 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 thesitedirectory, which can be published)
Customization
Edit the generated template.html and static assets in the ./static directory to customize the site.
Note
- The sync can be stopped (Ctrl+C) any time to be resumed later.
- Setup a cron job to periodically sync messages and re-publish the archive.
- Downloading large media files and long message history from large groups continuously may run into Telegram API's rate limits. Watch the debug output.
Licensed under the MIT license.
관련 프로젝트 살펴보기
불러오는 중…