bellingcat / telegram-phone-number-checker

Check if phone numbers are connected to Telegram accounts.
https://pypi.org/project/telegram-phone-number-checker/
MIT License
1.02k stars 172 forks source link

Add support for proxy network #28

Open cshuitao opened 1 month ago

cshuitao commented 1 month ago

Can this script access Telegram through a proxy network?

MsFGz commented 1 month ago

该脚本可以通过代理网络访问 Telegram 吗?

I also want to ask this question

hantconny commented 1 month ago

在login方法中,把代理加上 client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH, proxy=('http', '127.0.0.1', 7890)) 另外根据telethon的文档,不同版本需要安装不一样的socks库。

MsFGz commented 1 month ago

在登录方法中,把代理加上 client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH, proxy=('http', '127.0.0.1', 7890)) 另外根据telethon的文档,不同版本需要安装不一样的socks库。

非常感谢

GalenReich commented 1 month ago

It's great to see this workaround from @hantconny (translated):

In the login method, add the proxy client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH, proxy=('http', '127.0.0.1', 7890)) In addition, according to telethon's documentation, different versions need to install different socks libraries .

We would welcome a PR that would add a proxy configuration command line option to the tool 🎉

MsFGz commented 1 month ago

在login方法中,把代理加上 client = TelegramClient(PHONE_NUMBER, API_ID, API_HASH, proxy=('http', '127.0.0.1', 7890))客户端 = TelegramClient(PHONE_NUMBER, API_ID, API_HASH, proxy=('http', '127.0.0.1', 7890)) 另外根据telethon的文档,不同版本需要安装不一样的socks库。

请问我在login方法中,按照你说的把代理加上了,可是还是“Logging in...Attempt 1 at connecting failed: TimeoutError:”;请问您说的socks库和这有关系吗,如果有的话请问我需要安装哪个版本的socks库 Translate:Excuse me, in the login method, I added the agent as you said, but it is still "Logging in... Attempt 1 at connecting failed: TimeoutError:”; Does the socks library you mentioned have anything to do with this? If so, which version of the socks library I need to install?

hantconny commented 1 month ago

参考telethon的文档,https://docs.telethon.dev/en/stable/basic/signing-in.html#signing-in-behind-a-proxy

MsFGz commented 1 month ago

参考telethon的文档,https://docs.telethon.dev/en/stable/basic/signing-in.html#signing-in-behind-a-proxy

好的谢谢你,这个建议是有效果的,我现在已经可以成功的运行了

79946345 commented 1 month ago

What should I do with the displayed error! The proxy has also been configured, but the request was not successful after being sent. "No response, the phone number is not on Telegram or has blocked contact adding. I understand this issue and it must be in the same region. So what should I do with different regions?

显示的这个报错该怎么办呀!代理也配置了,就是发送请求后不成功。"No response, the phone number is not on Telegram or has blocked contact adding. 这个问题明白了,必须要是用一个地区的。那么不同地区的该怎么办呐?

GalenReich commented 1 month ago

Are you sure that the number you are checking is on Telegram? This is the expected behaviour when a number can't be found. There is also a way for accounts to block contact adding, which means the tool won't return any results and will give this message instead.

79946345 commented 1 month ago

Thank you for your reply. I have modified my post and you may not have seen it. I understand the original issue.