This project exports Telegram chats using the tdl command line tool and presents them through a small FastAPI web interface. Messages are saved in SQLite databases, attachments can be downloaded automatically and the viewer fetches Open Graph data for link previews.
- Quick search, better than Telegram's built-in search.
- Export your history.
- Parse and store messages in per chat SQLite databases.
- Web server to manage chats and browse them.
- Background workers periodically update chats based on saved settings.
- Searchable HTML viewer with inline media display and link previews.
- Install Python 3 and the
tdltool. - Install dependencies:
pip install -r requirements.txt
- Log in with
tdl:tdl login -T qr
- Start the server:
Visit
uvicorn telegram_bot.web_server:app --host 0.0.0.0 --port 8000
http://localhost:8000/to add a chat and start its worker. Open/chat/<chat_id>to browse messages.
- Ensure you have permission to archive the desired Telegram chats.
本项目借助 tdl 工具导出 Telegram 聊天记录,将消息保存到 SQLite 数据库,并提供可搜索的 FastAPI 网页界面。可以自动下载附件并抓取链接的 Open Graph 预览信息。
- 快速搜索,比 Telegram 好用 89.6 倍
- 导出聊天记录。
- 解析 JSON 数据并写入各聊天对应的 SQLite 数据库。
- FastAPI 服务器提供管理界面,可启动后台线程定期更新聊天。
- 浏览聊天时支持搜索、无限滚动、媒体展示以及链接预览。
- 所有数据存放在
data/与downloads/目录下。
- 安装 Python 3 与
tdl工具。 - 安装依赖:
pip install -r requirements.txt
- 使用
tdl登录:tdl login -T qr
- 启动服务器:
访问
uvicorn telegram_bot.web_server:app --host 0.0.0.0 --port 8000
http://localhost:8000/添加聊天后启动监听,再在/chat/<chat_id>查看聊天记录。
- 请确保有权限访问并归档相应的 Telegram 聊天。