Telethon: TypeError: 'ChannelParticipants' object is not subscriptable
Code that causes the issue
i = 0
async for user in client.iter_participants(dialog):
if not user.bot:
DATA.update(
{
i:{
'first_name': user.first_name,
'last_name': user.last_name,
'username': user.username,
'phone': user.phone,
'access_hash': user.access_hash,
'id': user.id
}
}
)
i +=1
Traceback
Traceback (most recent call last):
File ".\main.py", line 112, in <module>
client.loop.run_until_complete(main())
File "D:\python\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File ".\main.py", line 54, in main
async for user in client.iter_participants(dialog):
File "D:\python\lib\site-packages\telethon\requestiter.py", line 74, in __anext__
if await self._load_next_chunk():
File "D:\python\lib\site-packages\telethon\client\chats.py", line 224, in _load_next_chunk
participants = results[i]
TypeError: 'ChannelParticipants' object is not subscriptable
As same as 928, @Lonami referenced a solution in comment section which was The issue is fixed in the development version.
The issue appears to be persisting from 2018 until today, and development version seems not useful in this case. any solutions or replacements?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 24
Commits related to this issue
- Ignore aggressive parameter in iter_participants It's broken (it causes flood wait immediately). Closes #3787. — committed to JackPot777/Telethon by Lonami 2 years ago
the quickest solution I figured out:
await client.get_participants(group, aggressive=False, limit=limit)hope it’s helpful.
when participants count over 10k, it won’t get all the members
Did you figure out how to scrap the members for the entire group with over 10k members? It seems to be possible since it can be displayed in the official client. But I don’t know how to make it.
Thanks, That worked