A toolkit for scraping Telegram to investigate shady goings on.
-
Download all files and save to directory of choice.
-
Ensure pandas and telethon are installed.
pip install pandas
pip install telethon
-
Obtain your Telegram API details from my.telegram.org (further instructions to be added here).
-
In terminal, navigate to the installation directory (eg, desktop) and run setup.py
cd Desktop
python3 setup.py
- Executing the setup.py file will walk you through the Telegram API login and prepare the toolkit with your details.
n.b: Currently there is no easy installation, however, I'm working on properly packaging everything to make this straightforward for non-technical users.
Upon installation completion, you will be able to launch the toolkit from launcher.py
cd Desktop
python3 launcher.py
The launcher will guide you through each of the tools. Here is an overview.
-
Scrape group members Scrapes all group members from a Telegram group you are part of. Exports as a .CSV containing the username (when available), user id, name, group name and group ID. The file is named after the group.
-
Scrape forwards from chats you are in Scrapes all forwards from a chat you are following. Saves from, from ID, to and to ID to forwards_data.csv. It can then scrape forwards from all the discovered channels for a larger network map. This second feature takes a long time to run, but is worthwhile for a broader analysis.
-
Scrape forwards from a channel Scrapes all forwards from any channel you specify. It can then scrape forwards from all the discovered channels for a larger network map. This second feature takes a long time to run, but is worthwhile for a broader analysis.
Currently only scrapes from user and to user then saves to ef_edgelist.csv.
-
An option to export all data (from user, from user ID, to user, and to ID) OR simply exporting an edgelist for direct analysis.
-
Updating all save files to generate unique names for each group/chat scraped.
-
Tool to archive all messages and media from a chat.
-
Sometimes, when using scrape group members, returning to the launcher, then selecting scrape forwards from chats you are in, the toolkit will crash. This is an API error and can be avoided by restarting the launcher.
-
Scrape forwards from chats you are in displays an error message when you try to pull from Groups rather than Channels. Working on a fix to omit groups from the generated list.
Please send all feedback either to (@jordanwildon) on Twitter, or to jordanwildon@protonmail.com
This project is still being tested and is not currently licensed. Please contact (@jordanwildon) on Twitter, or email jordanwildon@protonmail.com for usage information and restrictions.
All tools created by Jordan Wildon (@jordanwildon) and Alex Newhouse (@AlexBNewhouse).