How to use the API to obtain the number of participants of the channel of the Telegrams?

Hello! Please help to find a team, how to use the API in Telegram it is possible to obtain the value of the number of subscribers on the channel that I signed. Thanks in advance!
June 14th 19 at 20:33
3 answers
June 14th 19 at 20:35
June 14th 19 at 20:37
Palud a close: tgspambot.tk
Hey, I for his use of banned
June 14th 19 at 20:39
Using Python 3 is very simple:

from time import sleep

from telethon import TelegramClient

from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch

api_id = <app_id>
api_hash = '<app_hash>'
phone = '+88005553535'
group_link = 't.me/joinchat/<group_hash>'

client = TelegramClient('session_name', api_id, api_hash)
client.connect()
channel = client.get_entity(group_link)

if not client.is_user_authorized():
client.send_code_request(phone)
 client.sign_in(phone input('Please Enter the verification code: '))

def get_users(a_channel):
 offset = 0
 limit = 100
 all_participants = []
 while True:
 participants = client.invoke(GetParticipantsRequest(
 a_channel, ChannelParticipantsSearch("), offset, limit, hash=0
))
 if not participants.users:
break
all_participants.extend(participants.users)
 offset += len(participants.users)
sleep(1)
 return all_participants

def print_users(a_users):
 for user in a_users:
print(user.username)

print_users(get_users(channel))</group_hash></app_hash></app_id>


Read more:
https://github.com/LonamiWebs/Telethon
https://github.com/LonamiWebs/Telethon/wiki/Retrie...

Find more questions by tags PHPMessengersTelegramHTMLJavaScript