{ "info": { "author": "Kostya Kravets", "author_email": "kostikkv@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "# Telegram Messages Dump \n[![GitHub version](https://badge.fury.io/gh/Kosat%2Ftelegram-messages-dump.svg)](https://github.com/Kosat/telegram-messages-dump/releases)\n[![Build Status](https://travis-ci.org/Kosat/telegram-messages-dump.svg?branch=master)](https://travis-ci.org/Kosat/telegram-messages-dump)\n\nThis is a simple console tool for dumping message history from a Telegram chat into a __jsonl__, __csv__ or plain __text__ file. \n## Installation\n**From sources:**\nFetch the latest sources with git:\n```\ngit clone https://github.com/Kosat/telegram-messages-dump.git\n```\nThen run directly from sources\n```\ncd telegram-messages-dump\npython -m telegram_messages_dump\n```\nOr run after installing locally\n```\npython setup.py install\ntelegram-messages-dump\n```\n**Binaries:**\n\nBinaries for Linux, Windows ~~and MacOS~~ are available in [Releases](https://github.com/Kosat/telegram-messages-dump/releases) section.\n\n## Usage\n\nMandatory parameters are e.g. @Python, @CSharp or a title of a dialogue, as seen in the UI, and - a telephone number. A phone number is needed for authentication and will not be stored anywhere. After the first successful authorization it will create telegram_chat_dump.session file containing auth token. The information from this file is being reused in next runs. If this is not a desirable behaviour, use -cl flag to delete session file on exit.\n>Note1: You can use telegram dialogue multi-word title like so: `--chat=\"Telegram Geeks\"` with double quotes. However, when using multi-word title (rather than @channel_name), you need to join the channel first. Only then you will be able to dump it. This way you can dump __private__ dialogues which doesn't have @channel_name.\n\n>Note2: For private channels you can also pass an invitation link as chat name. E.g. `--chat=\"https://t.me/joinchat/XXXXXYYYYZZZZZ\"`.\n__IMPORTANT__: It only works when you (the logged-in user) has already joined the private chat that the invitation link corresponds to.\n\n```\ntelegram-messages-dump -c -p [-l ] [-o ] [-cl]\n\nWhere:\n -c, --chat Unique name of a channel/chat. E.g. @python.\n -p, --phone Phone number. E.g. +380503211234.\n -o, --out Output file name or full path. (Default: telegram_.log)\n -e, --exp Exporter name. text | jsonl | csv (Default: 'text')\n , --continue Continue previous dump. Supports optional integer param .\n -l, --limit Number of the latest messages to dump, 0 means no limit. (Default: 100)\n -cl, --clean Clean session sensitive data (e.g. auth token) on exit. (Default: False)\n -v, --verbose Verbose mode. (Default: False)\n , --addbom Add BOM to the beginning of the output file. (Default: False)\n -h, --help Show this help message and exit.\n```\n![telegram-dump-gif](https://user-images.githubusercontent.com/153023/36110898-fda2e7f6-102c-11e8-9475-471063004be8.gif)\n\n## Increamental/Continuous mode\nAfter dumping messages into an output file, `telegram-messages-dump` also creates a **meta file**\nwith the latest (biggest) message id that was successfully saved into an output file.\nFor instance, if messages with ids 10..100 were saved in output file, the metafile will contain the `\"latest_message_id\": 100` record in it.\n\n- If you want to update an existing dump file use `--continue` option without a parameter value. In this case `telegram-messages-dump` will read the latest message id from a meta file. In the sample below it will be `C:\\temp\\xyz.txt.meta`:\n ```\n telegram-messages-dump -p... -oC:\\temp\\xyz.txt --continue\n ```\n In this case `telegram-messages-dump` will look for `C:\\temp\\xyz.txt.meta` file and try to incrimentally update the contents of `C:\\temp\\xyz.txt` with new messages.\n>Note: In incremental mode when metafile exists `--exp` and `--chat` will be taken from the meta file and must NOT be specified explicitely as parameters. `--limit` setting has to be omitted.\n\n- Otherwise, if you DON'T have a metafile or want to ignore it, you can still open your dump file and find the last message's id at the bottom of the file and then specify it explicitly as `--continue=` command, along with the correct `--exp` and `--chat` that were used to generate the existing dump file.\n ```\n telegram-messages-dump -p... -oC:\\temp\\xyz.txt --continue=100500 --exp=jsonl --chat=@geekschat\n ```\nIn both aforementioned cases, `telegram-messages-dump` will open the existing `C:\\temp\\xyz.txt` file and append the newer messages that were posted in the telegram chat since the message with the message with id 100500 was created.\n>Note1: There must be `=` sign between the `--continue` command name and integer message id.\n\n>Note2: In incremental mode without metafile, `--out`, `--exp` and `--chat` must be specified explicitely as parameters. `--limit` setting has to be omitted.\n\n## Notes\n\n* This tool relies on [Telethon](https://github.com/LonamiWebs/Telethon) - a Telegram client implementation in Python.\n\n## Plugins\n\nOutput format is managed by *exporter* plugins. Currently there are two exporters available: **text**, **jsonl** and **csv**.\nExporters reside in `./exporters` subfolder. \nBasically an exporter is a class that implements three methods:\n- `format(...)` that extracts all necessary data from a message and stringifies it.\n- `begin_final_file(...)` that allows an exporter to write a preamble to a resulting output file.\n\nTo use a custom exporter. Place you `.py` file with a class implementing those 3 methods into `./exporters` subfolder and specify its name in `--exp ` setting. \n\n>Note1: the class name **MUST** exactly match the file name of its `.py` file. This very same name is used as an argument for the `--exp` setting.\n\n>Note2: in `.vscode` subfolder you can find the default settings that I use for debugging this project. \n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/Kosat/telegram-messages-dump/releases", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Kosat/telegram-messages-dump", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "telegram-messages-dump", "package_url": "https://pypi.org/project/telegram-messages-dump/", "platform": "", "project_url": "https://pypi.org/project/telegram-messages-dump/", "project_urls": { "Download": "https://github.com/Kosat/telegram-messages-dump/releases", "Homepage": "https://github.com/Kosat/telegram-messages-dump" }, "release_url": "https://pypi.org/project/telegram-messages-dump/0.4/", "requires_dist": null, "requires_python": "", "summary": "Telegram Messages Dump console utility.", "version": "0.4" }, "last_serial": 5005024, "releases": { "0.4": [ { "comment_text": "", "digests": { "md5": "dd30b6760fa595fbdb8d486c40b8f33c", "sha256": "dc3482136cf93fa619d633737bf475fe740a70ca1b667f5b72603bebdaf62b92" }, "downloads": -1, "filename": "telegram-messages-dump-0.4.tar.gz", "has_sig": false, "md5_digest": "dd30b6760fa595fbdb8d486c40b8f33c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17870, "upload_time": "2019-03-29T20:44:13", "url": "https://files.pythonhosted.org/packages/44/47/8057378196f9eebc8ca6b29d8c69eb6649001132e528fbdb23436a2da827/telegram-messages-dump-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd30b6760fa595fbdb8d486c40b8f33c", "sha256": "dc3482136cf93fa619d633737bf475fe740a70ca1b667f5b72603bebdaf62b92" }, "downloads": -1, "filename": "telegram-messages-dump-0.4.tar.gz", "has_sig": false, "md5_digest": "dd30b6760fa595fbdb8d486c40b8f33c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17870, "upload_time": "2019-03-29T20:44:13", "url": "https://files.pythonhosted.org/packages/44/47/8057378196f9eebc8ca6b29d8c69eb6649001132e528fbdb23436a2da827/telegram-messages-dump-0.4.tar.gz" } ] }