Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from telethon import TelegramClient, sync
- from telethon.tl.functions.channels import GetParticipantsRequest
- from telethon.tl.functions.channels import GetFullChannelRequest
- from telethon.tl.functions.messages import GetHistoryRequest
- from telethon.tl.types import PeerUser, PeerChat, PeerChannel
- from telethon.tl.types import ChannelParticipantsSearch
- from telethon import utils
- from telethon.tl.types import ChannelParticipantsAdmins
- from telethon import errors
- from time import sleep
- api_id = 2222
- api_hash = 'asdasd'
- phone_number = '+phone'
- ################################################
- # invite link for private channel
- #channel_id = 1234
- chat_id = 1234
- #inveite_link='t.me/'
- ################################################
- ################################################
- client = TelegramClient(phone_number,api_id,api_hash)
- assert client.start()
- if not client.is_user_authorized():
- client.send_code_request(phone_number)
- me = client.sign_in(phone_number, input('Enter code: '))
- #for dialog in client.get_dialogs(limit=200):
- # print (dialog.id,dialog.name)
- client.get_dialogs()
- #channel = client.get_entity(inveite_link)
- #channel = client.get_entity(PeerChannel(channel_id))
- chat = client.get_entity(PeerChat(chat_id))
- offset = 0
- limit = 200
- while True:
- participants = client(GetParticipantsRequest(
- chat, chat, offset, limit,hash=0))
- if not participants.users:
- break
- for _user in participants.users:
- print( _user.id,',', _user.username,',',_user.first_name,',',_user.last_name)
- # save User info to Database
- offset += len(participants.users)
Advertisement
Add Comment
Please, Sign In to add comment