How nynchezyabka/rozittaparser works
1. Product and entry points
Rozitta Parser is a local Python desktop application for authenticating to Telegram, downloading chat history/media into portable local archives, and exporting readable or RAG-ready documents. Runtime starts at main.py, which composes the application shell in ui/main_window.py; global settings and output locations are centralized in config.py.
2. Desktop UI and feature orchestration
The main window coordinates feature-specific screens rather than exposing a web/API service. Each major user journey has a UI module paired with an API/service-facing module:
• Authentication: features/auth/ui.py, features/auth/api.py
• Chat selection: features/chats/ui.py, features/chats/api.py
• Archive parsing: features/parser/ui.py, features/parser/api.py
Shared desktop widgets, styles, and calendar controls reside in core/ui_shared/widgets.py, core/ui_shared/styles.py, and core/ui_shared/calendar.py.
3. Telegram access and archive acquisition
Telegram is the principal external service, accessed through the auth/chat/parser feature APIs. The flow is: establish a Telegram session (classic API credentials or Telegram Desktop tdata import), enumerate eligible dialogs, let the user select chats/options, then fetch messages, discussion threads, participants, and media into a local archive. Networking accommodates proxy usage through socks.py and sockshandler.py; retry/rate-limit behavior is isolated in core/retry.py. README identifies Telethon as the Telegram client runtime behavior source.
4. Local persistence and archive lifecycle
Downloaded content is persisted locally in SQLite plus an output directory containing media and generated documents. core/database.py is the storage boundary for archive records; check_db.py supports database inspection/maintenance. Archive updates and longer-running update work are separated into features/update_archive/worker.py and features/update_archive/report_dialog.py. The design keeps Telegram acquisition distinct from subsequent offline export and inspection.
5. Parsing, media, and speech-to-text pipeline
Parser orchestration turns Telegram entities into normalized local records and downloaded assets via features/parser/api.py. Audio/video-note transcription is an optional local post-processing stage: core/stt/worker.py coordinates background work, core/stt/audio_converter.py prepares supported audio, and core/stt/whisper_manager.py manages local Whisper inference. This boundary avoids a cloud transcription dependency; transcription text can then be included in exports.
6. Export and knowledge-corpus generation
The export subsystem reads local archive data and renders DOCX, Markdown, HTML, or JSON, with filtering and grouping options such as dates, posts, participants, and reply context. features/export/generator.py is the central rendering coordinator, while features/export/filters.py and features/export/participants.py shape the selected message set. features/export/knowledge_base.py implements AI-oriented corpus/chunk preparation; features/export/xml_magic.py is the specialized document/XML formatting boundary.
7. Operational boundaries
The application is intended to run locally on Python 3.10–3.13, with portable binary builds produced by .github/workflows/build_binaries.yml. It depends materially on Telegram, local SQLite storage, local filesystem media/output directories, optional SOCKS/MTProto proxy connectivity, and local Whisper models/runtime. Cross-cutting error, logging, merge, and utility behavior is concentrated in core/exceptions.py, core/logger.py, and core/merger.py.
Main entry points: main_window.py Main window · api.py Archive acquisition · database.py Archive database · worker.py Local transcription
Components 19
Desktop application
- Application entry · Starts and composes the local desktop application.
main.py - Main window · Coordinates feature screens and user journeys.
ui/main_window.py - Settings and output paths
config.py - Shared UI controls
core/ui_shared/widgets.py
Telegram acquisition
- Authentication screen
features/auth/ui.py - Authentication service · Creates sessions from credentials or Telegram Desktop tdata.
features/auth/api.py - Chat selection screen
features/chats/ui.py - Dialog service · Enumerates eligible dialogs and selection options.
features/chats/api.py - Archive parser screen
features/parser/ui.py - Archive acquisition · Fetches messages, threads, participants, and media into local records.
features/parser/api.py - Telegram
- Proxy and retry · Provides SOCKS/MTProto connectivity and rate-limit retry behavior.
socks.py
Local archive and processing
- Archive database · Storage boundary for downloaded archive records.
core/database.py - Archive files · Stores media and generated output documents.
- Archive updates · Runs longer-lived local archive update work.
features/update_archive/worker.py - Local transcription · Coordinates optional audio and video-note transcription.
core/stt/worker.py - Whisper inference · Manages local Whisper model inference.
core/stt/whisper_manager.py
Export and corpus
- Export generator · Builds DOCX, Markdown, HTML, and JSON from local archives.
features/export/generator.py - Knowledge corpus builder · Prepares AI-oriented corpus chunks from selected content.
features/export/knowledge_base.py
Connections 24
- Application entry → Main window: launches
- Application entry → Settings and output paths: loads
- Main window → Shared UI controls: uses
- Main window → Authentication screen: hosts
- Main window → Chat selection screen: hosts
- Main window → Archive parser screen: hosts
- Authentication screen → Authentication service: authenticates through
- Chat selection screen → Dialog service: selects through
- Archive parser screen → Archive acquisition: starts acquisition
- Authentication service → Telegram: establishes session
- Dialog service → Telegram: lists dialogs
- Archive acquisition → Telegram: downloads content
- Authentication service → Proxy and retry: uses
- Archive acquisition → Proxy and retry: uses
- Archive acquisition → Archive database: normalizes records into
- Archive acquisition → Archive files: writes media to
- Archive updates → Archive database: updates
- Local transcription → Archive files: reads audio from
- Local transcription → Whisper inference: runs inference with
- Local transcription → Archive database: stores transcripts
- Export generator → Archive database: reads archive data
- Export generator → Archive files: writes documents to
- Knowledge corpus builder → Archive database: reads selected content
- Knowledge corpus builder → Archive files: writes corpus files