All Projects → gumblex → Tg Export

gumblex / Tg Export

Licence: lgpl-3.0
Export Telegram messages.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Tg Export

Tnt Village Bot
Bot Telegram per la ricerca di release pubblicate da TNTVillage
Stars: ✭ 37 (-30.19%)
Mutual labels:  telegram
Mtprotoproxy
Async MTProto proxy for Telegram
Stars: ✭ 1,014 (+1813.21%)
Mutual labels:  telegram
Enterprisealrobot
An anime themed telegram group management bot
Stars: ✭ 49 (-7.55%)
Mutual labels:  telegram
Rocketgram
Modern and powerful asynchronous telegram bot framework.
Stars: ✭ 37 (-30.19%)
Mutual labels:  telegram
Telegram Test Api
Simple implimentation of telegram API which can be used for testing telegram bots
Stars: ✭ 42 (-20.75%)
Mutual labels:  telegram
Kantek
kantek is a userbot written in Python using Telethon.
Stars: ✭ 45 (-15.09%)
Mutual labels:  telegram
3 body problem bot
Simulations of gravitational interaction of the random n-body systems
Stars: ✭ 36 (-32.08%)
Mutual labels:  telegram
Telegram Bot Groupagree
An advanced poll bot for Telegram
Stars: ✭ 52 (-1.89%)
Mutual labels:  telegram
Planetpython telegrambot
Django App Planet Python Telegram Bot
Stars: ✭ 42 (-20.75%)
Mutual labels:  telegram
Telegram Bot Ruby
Ruby wrapper for Telegram's Bot API
Stars: ✭ 1,039 (+1860.38%)
Mutual labels:  telegram
Teledax
Telegram index App
Stars: ✭ 36 (-32.08%)
Mutual labels:  telegram
Gpt2 Telegram Chatbot
GPT-2 Telegram Chat bot
Stars: ✭ 41 (-22.64%)
Mutual labels:  telegram
Depecher
Depecher - Unofficial Sailfish OS client for Telegram based on tdlib
Stars: ✭ 45 (-15.09%)
Mutual labels:  telegram
Twitter Downloader Telegram Bot
🤖 Telegram bot for download video from twitter.
Stars: ✭ 37 (-30.19%)
Mutual labels:  telegram
Marvin
The paranoid bot (framework)
Stars: ✭ 51 (-3.77%)
Mutual labels:  telegram
Garnet
Garnet — bot-friendly telethon
Stars: ✭ 36 (-32.08%)
Mutual labels:  telegram
Kotlin Firebase Group Chat
Group and OneonOne chat using firebase built in Kotlin similar to whatsapp.
Stars: ✭ 44 (-16.98%)
Mutual labels:  telegram
Teletor
Telegram Torrents Bot
Stars: ✭ 54 (+1.89%)
Mutual labels:  telegram
Nikoro
A plugin-based, all-in-one, Telegram Bot written in Node.js
Stars: ✭ 51 (-3.77%)
Mutual labels:  telegram
Telegram
Telegram library for the Elixir language
Stars: ✭ 46 (-13.21%)
Mutual labels:  telegram

tg-export

Deprecation notice: Since tg-cli is not maintained and becomes unusable, this project is deprecated. Please use alternatives like telegram-export instead.

Export Telegram messages, using telegram-cli. Patched version recommended.

This version (v3) is compatible with vysheng/tg/master AND vysheng/tg/test branches.

Note: The database format of this version (v3) is not compatible with the old ones. To convert old databases (v1 or v2), run python3 dbconvert.py [old.db [new.db]]

export.py

$ python3 export.py -h
usage: export.py [-h] [-o OUTPUT] [-d DB] [-f] [-p PEER] [-B] [-t TIMEOUT]
                 [-l] [-L] [-e TGBIN] [-v]

Export Telegram messages.

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output path
  -d DB, --db DB        database path
  -f, --force           force download all messages
  -p PEER, --peer PEER  only download messages for this peer (format:
                        channel#id1001234567, or use partial name/title as
                        shown in tgcli)
  -B, --batch-only      fetch messages in batch only, don't try to get more
                        missing messages
  -t TIMEOUT, --timeout TIMEOUT
                        tg-cli command timeout
  -l, --logging         logging mode (keep running)
  -L, --keep-logging    first export, then keep logging
  -e TGBIN, --tgbin TGBIN
                        telegram-cli binary path
  -v, --verbose         print debug messages

Lots of workaround about the unreliability of tg-cli is included (in this script and tgcli.py), so the script itself may be unreliable as well.

Common problems with tg-cli are:

  • Dies arbitrarily.
  • No response in the socket interface.
  • Slow response in the socket interface.
  • Half response in the socket interface, while the another half appears after the timeout.
  • Returns an empty array when actually there are remaining messages.

Note: When it's trying to get the remaining messages, the telegram-cli will crash like crazy. That's due to non-existent messages. For a quick fix, use this fork of tg-cli.

Which is called NO WARRANTY™.

logfmt.py

This script can process database written by export.py or tg-chatdig, and write out a human-readable format (txt, html, etc.) according to a jinja2 template.

usage: logfmt.py [-h] [-o OUTPUT] [-d DB] [-b BOTDB] [-D BOTDB_DEST] [-u]
                 [-t TEMPLATE] [-P PEER_PRINT] [-l LIMIT] [-L HARDLIMIT]
                 [-c CACHEDIR] [-r URLPREFIX]
                 peer

Format exported database file into human-readable format.

positional arguments:
  peer                  export certain peer id or tg-cli-style peer print name

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output path
  -d DB, --db DB        tg-export database path
  -b BOTDB, --botdb BOTDB
                        tg-chatdig bot database path
  -D BOTDB_DEST, --botdb-dest BOTDB_DEST
                        tg-chatdig bot logged chat id or tg-cli-style peer
                        name
  -u, --botdb-user      use user information in tg-chatdig database first
  -t TEMPLATE, --template TEMPLATE
                        export template, can be 'txt'(default), 'html',
                        'json', or template file name
  -P PEER_PRINT, --peer-print PEER_PRINT
                        set print name for the peer
  -l LIMIT, --limit LIMIT
                        limit the number of fetched messages and set the
                        offset
  -L HARDLIMIT, --hardlimit HARDLIMIT
                        set a hard limit of the number of messages, must be
                        used with -l
  -c CACHEDIR, --cachedir CACHEDIR
                        the path of media files
  -r URLPREFIX, --urlprefix URLPREFIX
                        the url prefix of media files

tgcli.py

Simple wrapper for telegram-cli interface.

Example:

tgcli = TelegramCliInterface('../tg/bin/telegram-cli')
dialogs = tgcli.cmd_dialog_list()

TelegramCliInterface(cmd, extra_args=(), run=True)

  • run() starts the subprocess, needed when object created with run=False.
  • send_command(cmd, timeout=180, resync=True) sends a command to tg-cli. use resync for consuming text since last timeout.
  • cmd_*(*args, **kwargs) is the convenience method to send a command and get response. args are for the command, kwargs are arguments for TelegramCliInterface.send_command.
  • on_info(text)(callback) is called when a line of text is printed on stdout.
  • on_json(obj)(callback) is called with the interpreted object when a line of json is printed on stdout.
  • on_text(text)(callback) is called when a line of anything is printed on stdout.
  • on_start()(callback) is called after telegram-cli starts.
  • on_exit()(callback) is called after telegram-cli dies.
  • close() properly ends the subprocess.

do_nothing() function does nothing. (for callbacks)

TelegramCliExited exception is raised if telegram-cli dies when reading an answer.

License

Now it's LGPLv3+.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].