Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit to the number of phone numbers? #32

Open
MsFGz opened this issue May 17, 2024 · 8 comments
Open

limit to the number of phone numbers? #32

MsFGz opened this issue May 17, 2024 · 8 comments

Comments

@MsFGz
Copy link

MsFGz commented May 17, 2024

Is there a limit to the number of mobile phone numbers you can get?
请问获取手机号数量有限制吗?

@hantconny
Copy link

According to my test, for batch numbers, you need to wait 270 - 280 seconds after 30 - 40 numbers. Otherwise, you will get a FloodException.
Numbers after this exception won't get any result, even these numbers are actually on telegram. And the most important thing is that your telegram appid may be banned.
Even though, I am not sure this solution will help, beacuse my two telegram appid seems been banned.

@MsFGz
Copy link
Author

MsFGz commented May 19, 2024

根据我的测试,对于批次号,30 - 40 个号码后需要等待 270 - 280 秒。否则,您将得到 FloodException。 此异常之后的号码将不会得到任何结果,即使这些号码实际上在电报上。而且最重要的是,你的telegram appid可能会被禁止。 尽管如此,我不确定这个解决方案是否有帮助,因为我的两个电报 appid 似乎被禁止了。

OK, thank you, I will set the query interval to 20s, it seems that at present there is also a problem, at present I test is with the api registered mobile phone number of the same country code of the mobile phone number can be detected, other countries and regions directly in the mobile phone address book to add the retrieved users, using this program but can not retrieve the display "error": "No response, the No response, the phone number is not on Telegram or has blocked contact adding.", when I changed to a brand new api, I found that it can detect the above mobile phone numbers in different countries and regions again, the main problem is how to avoid the api being banned by telegram!
好的,谢谢你,我将查询间隔设置为20s,好像目前也出现问题了,目前我测试得出的是与该api注册的手机号同一国家代码的手机号可以被检测到,别的国家地区的直接在手机通讯录添加检索到的用户,使用这个程序却检索不到显示"error": "No response, the phone number is not on Telegram or has blocked contact adding.",当我换一个全新的api的时候发现又可以检测的到上述不同国家地区的手机号了,目前主要问题是如何避免api被telegram给ban了

@ruchid123123
Copy link

ruchid123123 commented May 20, 2024

根据我的测试,对于批次号,30 - 40 个号码后需要等待 270 - 280 秒。否则,您将得到 FloodException。此异常之后的号码将不会得到任何结果,即使这些号码实际上在电报上。而且最重要的是,你的电报 appid 可能会被禁止。不过,我不确定这个解决方案是否有帮助,因为我的两个电报 appid 似乎被禁止了。

好的,谢谢,我将查询间隔设置为20s,看来目前也有问题,目前我测试的是用api注册的手机号可以检测到手机号的相同国家代码、其他国家和地区直接在手机通讯录中添加检索到的用户,使用此程序却无法检索显示“错误”:“无响应,无响应,电话号码不在 Telegram 上或已阻止联系人”添加。”,当我换了一个全新的api后,发现又可以检测到上述不同国家和地区的手机号码了,主要问题是如何避免该api被telegram封禁! 好,谢谢,我将查询间隔设置为20s,希望目前也出现问题了,目前我测试的是与该api注册的手机号相同国家代码的手机号可以被检测到,其他国家地区的直接在手机通讯录录添加搜索给用户,使用这个程序却搜索不到显示“错误”:“无响应,电话号码不在 Telegram 上或已阻止联系人添加。”,当我换一个全新的 api 的时候又发现可以检测到了上述不同国家地区的手机号了,目前主要问题是如何避免api被telegram给ban了

the biggest problem is there is a limit of the max number for it , so we couldn't use it automally for a lot of numbers.

@hantconny
Copy link

I googled an old thread on Stack Overflow, which leading to an old thread on reddit. It seems batch import less than 5000 numbers (which is the up limit of a batch import) is possible, then wait a long while (but nobody knows how long), and then you can add another batch of 5000 numbers.

The solution in this project is that, it only imports one number at a time (even you give a list of numbers in commadline), and then delete it while ImportContactsRequest accepts a list of numbers. So, I think you guys can modify the main.py and import 5000 numbers at a time to see if it works.

As for me, I don't have any telegram account to test now.

@hantconny
Copy link

根据我的测试,对于批次号,30 - 40 个号码后需要等待 270 - 280 秒。否则,您将得到 FloodException。 此异常之后的号码将不会得到任何结果,即使这些号码实际上在电报上。而且最重要的是,你的telegram appid可能会被禁止。 尽管如此,我不确定这个解决方案是否有帮助,因为我的两个电报 appid 似乎被禁止了。

OK, thank you, I will set the query interval to 20s, it seems that at present there is also a problem, at present I test is with the api registered mobile phone number of the same country code of the mobile phone number can be detected, other countries and regions directly in the mobile phone address book to add the retrieved users, using this program but can not retrieve the display "error": "No response, the No response, the phone number is not on Telegram or has blocked contact adding.", when I changed to a brand new api, I found that it can detect the above mobile phone numbers in different countries and regions again, the main problem is how to avoid the api being banned by telegram! 好的,谢谢你,我将查询间隔设置为20s,好像目前也出现问题了,目前我测试得出的是与该api注册的手机号同一国家代码的手机号可以被检测到,别的国家地区的直接在手机通讯录添加检索到的用户,使用这个程序却检索不到显示"error": "No response, the phone number is not on Telegram or has blocked contact adding.",当我换一个全新的api的时候发现又可以检测的到上述不同国家地区的手机号了,目前主要问题是如何避免api被telegram给ban了

Yes, I noticed that,too. My second test was on a remote box in africa, it reached about 65 results, which is more than my first test. After that, no more response.

The cell number I used to register telegram api and the target numbers are in different countries. So I guess this is not an issue.

As "No response, the phone number is not on Telegram or has blocked contact adding", This is not the original response by telegram, it's wrapped by this project when telegram gives an empty list.

@MsFGz
Copy link
Author

MsFGz commented May 20, 2024

根据我的测试,对于批次号,30 - 40 个号码后需要等待 270 - 280 秒。否则,您将得到 FloodException。此异常之后的号码将不会得到任何结果,即使这些号码实际上在电报上。而且最重要的是,你的电报 appid 可能会被禁止。不过,我不确定这个解决方案是否有帮助,因为我的两个电报 appid 似乎被禁止了。

好的,谢谢,我将查询间隔设置为20s,目前也有问题,目前我测试的是用api注册的手机号可以检测到手机号的相同国家代码、其他国家和地区直接在手机通讯录中为用户添加搜索,使用此程序却无法搜索显示“错误”:“无响应,无响应,电话号码不在 Telegram 上或已阻止斯托克添加。”,当我换了一个全新的 api 后,发现又可以检测到上述不同国家和地区的手机号码了,主要问题是如何该api被telegram封禁! 好,谢谢,我将查询间隔设置为20s,希望目前避免也出现问题了,目前我测试与该api注册的手机号相同国家代码的手机号可以被检测到,其他国家地区的直接在手机通讯录中添加搜索给用户,使用此程序却搜索不到显示“错误”:“无响应,电话号码不在 Tel的egram 上或已阻止斯托克添加。”,当我换一个全新的 api 的时候又发现可以检测到上述不同国家地区的手机号了,目前主要问题是如何避免 api 被 telegram 给禁止了

最大的问题是它的最大数量有限制,所以我们不能自动使用它来处理很多数字。

There is a limit to the maximum number of queries! ? Could you tell me how much it is?
查询的最大数量有限制!?请问可否告知是多少的?

@MsFGz
Copy link
Author

MsFGz commented May 20, 2024

我在 Stack Overflow 上搜索了一个旧线程,这导致了 reddit 上的一个旧线程。好像批量导入少于5000个号码(这是批量导入的上限)是可以的,然后等待很长一段时间(但没人知道要多久),然后你可以再添加一批5000个号码。

该项目中的解决方案是,它一次只导入一个号码(即使您在命令行中给出一串号码),然后在 ImportContactsRequest 接受一串号码时将其删除。所以,我觉得你们可以修改main.py,一次导入5000个数字,看看是否有效。

至于我,我现在没有任何电报帐户可以测试。

Sorry, I don't understand what you mean by "Stack Overflow has a programme that can batch query less than 5000 users at a time?" What do you mean by that solution is importing 5000 numbers at a time, is it a one time query using commas or do you mean not breaking the link to query 5000 numbers in turn.
不好意思,我没明白你的意思,请问你的意思是:"Stack Overflow有一个可以一次批量查询少于5000个用户的程序?"您说的该解决方案是一次导入5000个号码是啥意思,是使用逗号一次性查询,还是说不断开链接依次查询5000个号码。

@hantconny
Copy link

hantconny commented May 22, 2024

Check two links below:

According to these two links, batch import 5000 contacts at a time is supported by telegram api.
You can check the get_names function in main.py, now it takes only one phone number, but you can modify it to support 5000 numbers:

def get_names(client: TelegramClient, phone_numbers: list) -> dict:
    # a list to hold 5000 InputPhoneContact objects
    inputPhoneContact_list = []
    for phone_number in phone_numbers:
        inputPhoneContact_list.append(InputPhoneContact(client_id = 0, phone = phone_number, first_name="", last_name=""))
    
    contacts = client(functions.contacts.ImportContactsRequest(importContactPhone_list))

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants