SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top