tgle
tgle
- a Telegram link extractor.
Motivation
I found that I was sharing many links with myself via the Saved Messages chat
on Telegram. I also found that I was sharing some good content with
friends/colleagues on Telegram. The problem was that this content was quite
locked into Telegram and not so straightforward for me to import into my
(Obisidian based) information management system. Hence I wrote this simple tool
which support extracting links from Telegram.
Functionality
Currently, this tool can do the following:
- connects to Telegram, downloads new messages from Users and Chats
- stores the messages and links in a local
sqlite
db
- serve the content via a local web service which can be opened in a browser
- generate reports in either json or markdown format of recent links which have been imported
tgle
works with the Telegram API using the `gotd/td`` library.
Prerequisites
To run this app, you need to create an app on Telegram - this will generate an App ID and an App Hash
which will be linked to your Telegram account (and phone number).
Note that care needs to be taken with this information - it should not be put
in a public place such as a git repository. Telegram is frequently checking
for publication of such information and could potentially block your account if
they find such information published.
See How not to get banned for more.
Data sensitivity
This application receives message data from Telegram and stores it locally -
no information is sent elsewhere. Care should be taken with managing this
data as it could contain sensitive data.
The data is stored as follows:
{XDG_CONFIG_DIR}/tgle/config.toml
- a toml
file which contains your
Telegram phone number, App ID and App Hash
{XDG_STATE_HOME}/tgle/sqlite.db
- an sqlite
database which contains
information on links, messages, users and chats obtained from Telegram.
Running tgle
$ go build
$ ./tgle
Note that the first time you run this, it can take some time as it tries to obtain the page
title for all links which are obtained from Telegram.
Reset
If you need to reset this and remove all data generated by the app, run the following:
$ ./tgle --remove-all-state