{"id":13558161,"url":"https://github.com/tvdstaaij/telegram-history-dump","last_synced_at":"2026-03-04T14:05:37.286Z","repository":{"id":66173365,"uuid":"44500093","full_name":"tvdstaaij/telegram-history-dump","owner":"tvdstaaij","description":"Backup Telegram chat logs using telegram-cli","archived":false,"fork":false,"pushed_at":"2020-10-01T07:49:09.000Z","size":153,"stargazers_count":664,"open_issues_count":56,"forks_count":84,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-11-04T08:37:34.300Z","etag":null,"topics":["hacktoberfest","telegram"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tvdstaaij.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-18T22:57:55.000Z","updated_at":"2024-10-26T06:01:40.000Z","dependencies_parsed_at":"2023-02-20T23:15:35.673Z","dependency_job_id":null,"html_url":"https://github.com/tvdstaaij/telegram-history-dump","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvdstaaij%2Ftelegram-history-dump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvdstaaij%2Ftelegram-history-dump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvdstaaij%2Ftelegram-history-dump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvdstaaij%2Ftelegram-history-dump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tvdstaaij","download_url":"https://codeload.github.com/tvdstaaij/telegram-history-dump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247002540,"owners_count":20867473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","telegram"],"created_at":"2024-08-01T12:04:47.179Z","updated_at":"2026-03-04T14:05:37.248Z","avatar_url":"https://github.com/tvdstaaij.png","language":"Ruby","funding_links":[],"categories":["Ruby","hacktoberfest"],"sub_categories":[],"readme":"# telegram-history-dump\n\nThis utility is the successor of [telegram-json-backup][1], written from the\nground up in Ruby. It can create backups of your Telegram user and (super)group\ndialogs using telegram-cli's remote control feature.\n \nCompared to the old project, telegram-history-dump:\n\n* Has better support for media downloads\n* Supports output formats other than JSON and is extensible with custom formats\n* Supports incremental backup (only new messages are downloaded)\n* Does not depend on unstable Python/Lua bindings within telegram-cli\n* Has a separate YAML formatted configuration file\n\nThe default configuration will backup all dialogs to a directory named `output`,\nin JSON format, without downloading any media.\n\n## Usage\n\n### First time setup\n\n1. Compile [telegram-cli][3], start it once to link your Telegram account\n2. Make sure Ruby 2+ is installed on your system: `ruby --version`\n3. Optionally configure your backup routine by editing `config.yaml`\n\n### Performing a backup\n\n1. Start telegram-cli with at least the following options:\n   `telegram-cli --json -P 9009`\n2. While telegram-cli is running, execute the script:\n   `ruby telegram-history-dump.rb`\n\n## Formatters\n\nHistory will always be stored in [JSON Lines][5] compliant files. However,\nadditional output formats can be produced by uncommenting a few lines in the\nconfiguration file.\n\nYou can enable one or more of the following formatter modules:\n\n`html` creates styled, paginated chat logs vieweable with a web browser.\n\n`plaintext` creates human-readable text files, organized as one file per day. \n\n`bare` outputs only the actual message texts without any context. It is meant\nfor linguistic / statistical analysis.\n\n`pisg` creates daily logs compatible with the EnergyMech IRC logging format as\ninput for the [PISG][7] chat statistics generator. Also see [telegram-pisg][2].\n\nYou can also implement a custom formatter; see\n`formatters/lib/formatter_base.rb` for details.\n\n## Command line options\n\nMost of the backup configuration is done through the config file, but a few\nspecific options are available as CLI options. None of them are mandatory.\n\n```text\nUsage: telegram-history-dump.rb [options]\n    -c, --config=cfg.yaml            Path to YAML configuration file\n    -k, --kill-tg                    Kill telegram-cli after backup\n    -h, --help                       Show help\n    -d, --dir=DIR                    Subdirectory for output files\n                                     (relative to backup_dir in YAML config)\n    -l, --limit=LIMIT                Maximum number of messages to backup\n                                     for each target (overrides YAML config)\n```\n\n## Notes\n\nUsage notes:\n\n* It is possible to run telegram-cli on a different machine, e.g. as a daemon\n  on a server. In this case you must pass `--accept-any-tcp` to telegram-cli and\n  firewall the port appropriately to prevent unwanted exposure. Keep in mind\n  that some options regarding media files will not work in a remote setup.\n* Be careful with decreasing `chunk_delay` or increasing `chunk_size`. Telegram\n  seems to rate limit history requests. Going too fast may cause an operation\n  to time out and force the script to skip part of a dump.\n\nTelegram-cli issues known to affect telegram-history-dump:\n\n* [vysheng/tg#947][9] can cause crashes when dumping channels with more than 100\n  messages.\n* [vysheng/tg#904][10] can cause crashes when dialogs contain certain media\n  files. If you get this, recompile telegram-cli with the suggested workaround. \n\n[1]: https://github.com/tvdstaaij/telegram-json-backup\n[2]: https://github.com/tvdstaaij/telegram-pisg\n[3]: https://github.com/vysheng/tg\n[4]: http://bundler.io/\n[5]: http://jsonlines.org/\n[7]: http://pisg.sourceforge.net/\n[9]: https://github.com/vysheng/tg/issues/947\n[10]: https://github.com/vysheng/tg/issues/904\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvdstaaij%2Ftelegram-history-dump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftvdstaaij%2Ftelegram-history-dump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvdstaaij%2Ftelegram-history-dump/lists"}