Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from telethon import TelegramClient, sync
- # Use your own values here
- api_id = '123456'
- api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
- channel = 'channel_name'
- client = TelegramClient('Session_details', api_id, api_hash)
- phone_number='9199999999'
- client.connect()
- print("Connected")
- if not client.is_user_authorized():
- client.send_code_request(phone_number)
- me = client.sign_in(phone_number, input('Enter code: '))
- # get all the users and print them
- for u in client.iter_participants(channel, aggressive=True):
- print(u.id, u.first_name)
- client.disconnect()
- print("Disconnected")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement