Commit Graph
4 Commits
Author SHA1 Message Date
tiennm99 275ec47576 feat: add tg-export, a resumable Telegram group media exporter
Exports all media from a group to disk, one folder per logical post with
albums collapsed, alongside a messages.jsonl sidecar linking every file
to its message.

Three properties the design is built around:

- Identity is filter-invariant. A post's folder is the lowest message id
  in the full grouped_id group and filenames key on message id, so
  --types photo and --types video address the same files. A positional
  index would shift whenever a member message was deleted.
- The cursor commits only after a complete post and is unreachable from
  every error path, so it can never point past in-flight work.
- Filters are stored verbatim; a mismatch refuses the run and names what
  changed, because the cursor means 'handled through here under these
  filters'.

Exactly one untrusted string becomes a path component: the filename
leaf, sanitized stem and extension both. Every other component is an int
enforced by type. The export directory is the chat id rather than the
group title, which makes traversal via a renamed group structurally
impossible and stops a mid-export rename from orphaning the download.

Downloads are sequential. Telethon does not parallelize transfers, and
concurrency mainly accelerates flood-wait escalation from seconds to
hours.
2026-08-12 20:10:00 +07:00
tiennm99 65f8abdf18 build: add packaging and pin the verified Telethon version
Telethon 2.0 is alpha with a renamed API surface, hence the <2 bound.
requirements.txt records 1.44.0, the version the API probes were run
against, so a later resolver bump cannot silently change the semantics
the traversal depends on.
2026-08-12 15:45:00 +07:00
tiennm99 de9a08796e chore: add gitignore covering sessions, exports, and credentials 2026-08-12 15:01:53 +07:00
tiennm99 4ce369d953 Initial commit 2026-08-11 14:07:26 +07:00