avatarHKN MZ

Summary

This text provides a tutorial on how to use Python and Telethon to extract group members from Telegram.

Abstract

The tutorial begins by guiding users on how to obtain their Telegram API ID and hash values from the my.telegram.org website. It then introduces Telethon, an asyncio Python 3 MTProto library used to interact with Telegram's API. The text explains that Telethon simplifies the process of creating Python programs that can interact with Telegram. After installing the Telethon library using pip, the tutorial provides a code block for extracting group members and storing their details in a CSV file.

Opinions

  • Telegram is a popular communication app used for managing communities and promotions.
  • The tutorial assumes that the reader has a basic understanding of Python and how to use pip for installing libraries.
  • The tutorial emphasizes the importance of saving the obtained API ID and hash values for future use.
  • The tutorial suggests that using Telethon simplifies the process of interacting with Telegram's API.
  • The tutorial provides a practical application of Python and Telethon by demonstrating how to extract group members from Telegram.
  • The tutorial suggests that the extracted group member details can be stored in a CSV file for further analysis or use.
  • The tutorial is part of a series of Python-related tutorials, with links to other related articles provided at the end.

Get Telegram Group Members with Python and Telethon

Telegram is one of the best communications apps around the world. People usually use Telegram for managing their communities and promotions. In this tutorial, you will learn how to use Telegram API extract group members.

Let’s get the your telegram api_id and api_hash values. Go to my.telegram.org you will see this are:

Log in here to manage your apps using Telegram API or delete your account. Enter your number and we will send you a confirmation code via Telegram (not SMS).

After login, you will see this picture:

Click on API development tools and fill the required fields. You can choose any name for your app. For example I choosed demo1. After submitting, you will receive App api_id and api_hash like on the picture.

Please save your api_id and api_hash values to somewhere. You will use these api_id and api_hash to login to Telegram API.

What is Telethon?

Telethon is an asyncio Python 3 MTProto library to interact with Telegram’s API as a user or through a bot account. This library is meant to make it easy for you to write Python programs that can interact with Telegram. Think of it as a wrapper that has already done the heavy job for you, so you can focus on developing an application.

Let’s install telethon using pip:

pip install telethon

After installing telethon library. Here is the all code block with statements.

When you run code you will choose group name of your groups. After you choosed a group name you will get all users of group. Then we stored username, name, user id, user hash and the group details for every user in the CSV file.

More stories to read.

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

Looking to scale your software startup? Check out Circuit.

Python
Telegram
Scraper
Python Programming
Telegram Bot
Recommended from ReadMedium