Apr-29-2018, 03:33 PM
(This post was last modified: Apr-29-2018, 03:33 PM by StrongHandsDeepPockets.)
I need to add a specific Argument at get_channel_participants. For some bloody reason, I can't. Here is the reference from Telethon's documentation (iter_participants is the same with get_participants): http://telethon.readthedocs.io/en/latest...rticipants. I am looking to add "aggressive". I tried a lot of variants and I failed every time.
Note: I am quite a newbie, so please excuse my rough language. I used the documentation above to write the code below, but I have hit a wall...Thank you in advance.
Note 2: The code itself works like a charm, but if I add "aggressive" it doesn't. For me, using the argument is compulsory.
Note: I am quite a newbie, so please excuse my rough language. I used the documentation above to write the code below, but I have hit a wall...Thank you in advance.
Note 2: The code itself works like a charm, but if I add "aggressive" it doesn't. For me, using the argument is compulsory.
from telethon import TelegramClient
from telethon.tl.functions.contacts import ResolveUsernameRequest
from telethon.tl.functions.channels import GetAdminLogRequest
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import InputChannel
from telethon.tl.types import ChannelAdminLogEventsFilter
from telethon.tl.types import InputUserSelf
from telethon.tl.types import InputUser
from time import sleep
def get_channel_participants(channel, offset, batch_size):
api_id = 2vbdg
api_hash = 'gvf6483f445c1'
phone_number = '+lfd03'
client = TelegramClient(phone_number, api_id, api_hash)
client.start()
offset = 0
limit = 100
all_participants = []
while True:
participants = client(GetParticipantsRequest(
channel, ChannelParticipantsSearch(''), offset, batch_size,
hash=0
))
if not participants.users:
break
all_participants.extend(participants.users)
offset += len(participants.users)
sleep(5)
return all_participants
users = get_channel_participants('asdfasdf1234123', 0, 100)
len(users)
