I was wondering whether anyone could give me an idea how to get participants counts of the past from a Telegram channel. I am using the telethon package.
According to an issue from their git (issue #1648) which asked something similar, I tried the get_stats() method:
with TelegramClient(session, api_id, api_hash) as client:
channel_stats = client.get_stats(channel=chat_name)
# channel_request = client(GetFullChannelRequest(channel=channel_name))
However, I get the ChatAdminRequiredError exception altough the channel has about 150k participants (the telethon documentation says this error may be raised when the group has not enough members):
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 5, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/sync.py", line 39, in syncified
return loop.run_until_complete(coro)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/telethon/client/users.py", line 84, in _call
result = await future
telethon.errors.rpcerrorlist.ChatAdminRequiredError: Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group (caused by GetBroadcastStatsRequest)
I investigated the results from a GetFullChannelRequest of the same channel and I noticed that both attributes can_view_stats and can_view_participants are set to False.
Does this indicate that I am indeed not able to view stats?
Is there a way to get a participant count history of a channel? (not member lists, just counts would be great)
Many thanks in advance!