telegram-backup-to-txt icon indicating copy to clipboard operation
telegram-backup-to-txt copied to clipboard

Tool to dump telegram into text files for quick search (e.g. with grep)

#+begin_src python :exports results :results output drawer import convert_to_plaintext print(convert_to_plaintext.doc) #+end_src

#+RESULTS: :results:

Script to convert HTML output from [[https://github.com/fabianonline/telegram_backup][telegram_backup]] tool to plaintext with proper filenames.

I'm using it for quick search (e.g. =grep=) in messages without having to go to web interface/mobile app. You can read more about it [[https://beepb00p.xyz/pkm-search.html#other][here]].

  • Usage
  1. Read [[https://github.com/fabianonline/telegram_backup#usage][usage for telegram_backup]] to backup your account. Don't forget to run =--export html=!
  2. Run this script with the same =--target= and =--account= arguments as for backup script, and pass =--output= directory.

Personally I've got all this set up as a daily Cron job.

** Dependencies

~apt install sqlite3 html2text~

:end: