How to make a Telegram members scraper and adder to copy and add unlimited members to you group
We are going to scrape Telegram group members and add it to your own group. We will also use a bunch of techniques to be able to add unlimited members to your Telegram group by bypassing Telegram limitations that suppresses the process after adding 50 members. this article includes Telegram group member extractor tutorial and also inclues the python code of Telegram group member adder so you will be able to copy Telegram group members.
Step 1: Obtain API ID and API HASH
In order to communicate with Telegram API, we are required to obtain API ID and API HASH from My Telegram page.
Step 2: Export competitor group members
Visit the tutorial here to learn to export members from a Telegram group.
Step 3: Creating multiple accounts for adding members and how to bypass the adding limits
In case you don't know, there are many factors that effect the number of members each account can add everyday.
Which country to use for making accounts?One of the most important factors is the country that the simcart blongs to. Countris like USA, Spain, Netherlands, Sweden have by far the best virtual numbers for creating accounts and adding members. There are many websites out there that sell virtual numbers for very cheap and reasonable prices. however it is recommend to use real simcarts if possible.
Can my API ID and API HASH get poisened and detected as spammer?Another factor that is important, is the API ID and API HASH that you use for creating accounts. Incase those API credintials are poinsened (detected as unsual or spammy behaviour), you will have to obtain new ones from a new account because each account can only have one pair of API ID and API HASH.
Is it safe to add a lot members to a single group in a short time?Another factor is relevant to how you use the numbers, if you add many members to a group in one signle day, the chances are that many of those members report the group spam and this might make the Telegram spam detection algorithms ban the adder accounts or even the group itself might get deleted! So you need to be cautious with this process.
What should I do when the accout gets flooded?Please note that if an account (session) is flooded, there is a high chance that it might get pure again after 10 minutes, 12 hours or 3 days. However spammy accounts tend to get deleted after hitting a flood error caused by adding members. In case a number is detected as a spammer by Telegram, deleting that account and registering again won't help to purify the spam flag on that account.
What should I do if every account I make gets Deleted (Deleted Account) after using it for adding members?In such cases, create your accounts using an Official version of Telegram (Telegram for iOS, Android, etc) and wait for 3 days. after 3 days, make a session out of the account. This will make the account stronger.
What other things matter in creating accounts?Based on my personal experience, the creator of a group also effects the way you can add members to that group. Like groups thare are created by Asian accounts might not get members that are from other continents. For example a group from India has a very hard time accepting members from europian countries. So if you try to add (europian) members to such (indian) groups your accounts are very likely to get deleted! This applies to many Asian groups from different countries as well.
from telethon import TelegramClient, sync
This will create a session out of the number you enter (after running the python file) and saves the session into a file named
client = TelegramClient(SESSION_FILE_NAME, API_ID, 'API_HASH')
SESSION_FILE_NAME for future use (adding members!).
Remember to change the
SESSION_FILE_NAME each time you make a new session so you won't overwrite the previous one!
Step 4: Adding members to your own group using the sessions you have created
Ok here we go!
Our script iterates over all the session that you have created and will use them one by one to add members until they get flooded or banned or stopped by any kind of terminating exception.
Let's import the required modules first.
from telethon import TelegramClient, sync, connection
from telethon.errors.rpcerrorlist import FloodWaitError
from telethon.errors.rpcerrorlist import FloodError, UserAlreadyParticipantError, InviteHashInvalidError, InviteHashExpiredError
Now we write a single line of code to collect all session files (all acccounts) that are in the current folder
all_sessions = [x for x in os.listdir('.') if 'session' in x and 'journal' not in x]
Now lets iterate through all sessions using a
for loop, and connect to the API!
for session in sessions:
client = TelegramClient(session.split('.'), API_ID, 'API_HASH')
me = client.get_me()
if not me:
Now that we are connected to the API, lets get the group detailts we are trying to add members to and join it!
group = client.get_entity('https://t.me/your_group_public_username')
We joined the group! Now lets add the members we have in our list to the our group! We're going to open the file, read each line (each line is a user we want to add). and try adding the user to the group. In case we get any flood errors as the exception, we switch the account to add the rest of members using a frech session!
with open(members_file, 'r') as the_file:
members = the_file.read().split('\n')
for m in members:
if switch_account == True:
except Exception as ex:
if any(s in str(ex) for s in ['Too many', 'deleted/deactivated', 'banned', 'seconds is required', 'USER_DEACTIVATED_BAN', 'write in this chat']):
switch_account = True
Author: Amin Etesamian
copy telegram group members telegram group member adder telegram group member extractor scrape telegram group python add unlimited members in telegram group