{"action":"created","issue":{"url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/580","repository_url":"https://api.github.com/repos/LonamiWebs/Telethon","labels_url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/580/labels{/name}","comments_url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/580/comments","events_url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/580/events","html_url":"https://github.com/LonamiWebs/Telethon/issues/580","id":294098277,"number":580,"title":"GetParticipantsRequest  gets only 10000 Members and not more.","user":{"login":"CodeDem","id":8732860,"avatar_url":"https://avatars1.githubusercontent.com/u/8732860?v=4","gravatar_id":"","url":"https://api.github.com/users/CodeDem","html_url":"https://github.com/CodeDem","followers_url":"https://api.github.com/users/CodeDem/followers","following_url":"https://api.github.com/users/CodeDem/following{/other_user}","gists_url":"https://api.github.com/users/CodeDem/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeDem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeDem/subscriptions","organizations_url":"https://api.github.com/users/CodeDem/orgs","repos_url":"https://api.github.com/users/CodeDem/repos","events_url":"https://api.github.com/users/CodeDem/events{/privacy}","received_events_url":"https://api.github.com/users/CodeDem/received_events","type":"User","site_admin":false},"labels":[{"id":431466822,"url":"https://api.github.com/repos/LonamiWebs/Telethon/labels/duplicate","name":"duplicate","color":"cccccc","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":26,"created_at":"2018-02-03T09:36:38Z","updated_at":"2018-03-14T12:12:23Z","closed_at":"2018-02-03T09:38:20Z","author_association":"NONE","body":"Python 3.6\r\n\r\nI am working on a project to get a list of members of a group or channel:\r\n\r\nI followed the code sample given in the doc to retrieve all the members:\r\n\r\n[Click Here](http://telethon.readthedocs.io/en/latest/extra/examples/chats-and-channels.html#retrieving-all-chat-members-channels-too)\r\n\r\nhttp://telethon.readthedocs.io/en/latest/extra/examples/chats-and-channels.html#retrieving-all-chat-members-channels-too\r\n\r\n```\r\noffset = 0\r\nlimit = 100\r\nall_participants = []\r\nchannel = 'thecoinfarm'\r\nwhile True:\r\n    participants = client(GetParticipantsRequest(\r\n        channel, ChannelParticipantsRecent(), offset, limit,\r\n        hash=0\r\n    ))\r\n    if not participants.users:\r\n        break\r\n    all_participants.extend(participants.users)\r\n    offset += len(participants.users)\r\n    print(offset)\r\n```\r\n\r\nI saw that it can only retrieve 10000  members and not more. The given test channel has approx 27 thousand members and I was able to extract only 10000 of them, so my question is, is that the limitation from telegram?\r\n\r\nI went through the telegram API doc and was not able to find this limitation, I also tried with a negative offset in an attempt to traverse from the back but it didn't work.\r\n\r\nJust wanted to know if it is possible to get all of the member lists.\r\nThanks for creating this project :) ."},"comment":{"url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/comments/372999709","html_url":"https://github.com/LonamiWebs/Telethon/issues/580#issuecomment-372999709","issue_url":"https://api.github.com/repos/LonamiWebs/Telethon/issues/580","id":372999709,"user":{"login":"kaxap","id":2851970,"avatar_url":"https://avatars0.githubusercontent.com/u/2851970?v=4","gravatar_id":"","url":"https://api.github.com/users/kaxap","html_url":"https://github.com/kaxap","followers_url":"https://api.github.com/users/kaxap/followers","following_url":"https://api.github.com/users/kaxap/following{/other_user}","gists_url":"https://api.github.com/users/kaxap/gists{/gist_id}","starred_url":"https://api.github.com/users/kaxap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaxap/subscriptions","organizations_url":"https://api.github.com/users/kaxap/orgs","repos_url":"https://api.github.com/users/kaxap/repos","events_url":"https://api.github.com/users/kaxap/events{/privacy}","received_events_url":"https://api.github.com/users/kaxap/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T12:12:23Z","updated_at":"2018-03-14T12:12:23Z","author_association":"NONE","body":"Searching by key other than an empty string does not return anything for me. \r\n\r\n```python\r\n    from string import ascii_lowercase, digits, punctuation\r\n\r\n    offset = 0\r\n    limit = 100\r\n    all_participants = []\r\n    ids = set()\r\n\r\n    channel='some_large_group'\r\n    query_key = ['', ' '] + list(ascii_lowercase + digits + punctuation)\r\n\r\n    for key in query_key:\r\n        print('using key ' + key)\r\n        while True:\r\n            participants = client(GetParticipantsRequest(\r\n                 channel, ChannelParticipantsSearch(key), offset, limit,\r\n                 hash=0\r\n            ))\r\n\r\n            if not participants.users:\r\n                break\r\n\r\n            for user in participants.users:\r\n                if user.id in ids:\r\n                    continue\r\n                ids.add(user.id)\r\n                all_participants.append(user)\r\n\r\n            offset += len(participants.users)\r\n            print(len(ids))\r\n```"}}
{"actor":{"display_login":"kaxap"}}