Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. from telethon import TelegramClient, sync
  2.  
  3. # Use your own values here
  4. api_id = '123456'
  5. api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  6. channel = 'channel_name'
  7.  
  8. client = TelegramClient('Session_details', api_id, api_hash)
  9. phone_number='9199999999'
  10.  
  11. client.connect()
  12. print("Connected")
  13. if not client.is_user_authorized():
  14. client.send_code_request(phone_number)
  15. me = client.sign_in(phone_number, input('Enter code: '))
  16.  
  17.  
  18. # get all the users and print them
  19. for u in client.iter_participants(channel, aggressive=True):
  20. print(u.id, u.first_name)
  21.  
  22.  
  23. client.disconnect()
  24. print("Disconnected")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement