Showing posts with label TypeError ChannelParticipants object is not subscriptable. Show all posts
Showing posts with label TypeError ChannelParticipants object is not subscriptable. Show all posts

Thursday, May 5, 2022

Telegram Export Group Members more than 10000

FloodWaitError - A wait of 30 seconds is required / Telegram Export Group Members more than 10000

aggressive=True attribute was used to export group members more than 10 K.

This attribute was used in the following line of code of Telegram export group members python script.

all_participants = client.get_participants(target_group, aggressive=True)
But recently telethon has started giving FloodWait error with this attribute.
If we remove it, or make it false, we can download members but less than 10k.

all_participants = client.get_participants(target_group, aggressive=False)

But Removing the attribute or making it false can export members of a group which has less than 10K members but it gives following error for the groups which have more than 10k members.

TypeError: 'ChannelParticipants' object is not subscriptable
github page of this issue suggests a solution for the error. Upgrade your Telethon package to 1.24.0 using following command.

python3 -m pip install --upgrade https://github.com/LonamiWebs/Telethon/archive/master.zip
but after upgrading telethon some users have started getting this new error.
Traceback (most recent call last):
  File "t1_exportgroup.py", line 1, in <module>
    from telethon.sync import TelegramClient
  File "/home/pavi/virtualenvs/telegram/lib/python3.8/site-packages/telethon/__init__.py", line 4, in <module>
    from ._misc import utils as _  # depends on helpers and _tl
  File "/home/pavi/virtualenvs/telegram/lib/python3.8/site-packages/telethon/_misc/utils.py", line 23, in <module>
    from . import markdown, html
  File "/home/pavi/virtualenvs/telegram/lib/python3.8/site-packages/telethon/_misc/markdown.py", line 8, in <module>
    import markdown_it
ModuleNotFoundError: No module named 'markdown_it'
A solution was also provided for the error. Install following packages.

pip install markdown-it-py~=1.1.0
pip install pyaes~=1.6.1
pip install rsa~=4.7.2
After applying this solution above error is gone but another error is here.
Traceback (most recent call last):
  File "t1_exportgroup.py", line 1, in <module>
    from telethon.sync import TelegramClient
ModuleNotFoundError: No module named 'telethon.sync'

Telethon 2 has removed sync module. If your export script is showing this error, you need to change the script according to the changes suggested in this version 2 migration guide.