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

Add support for proxy network #28

Open
cshuitao opened this issue May 14, 2024 · 10 comments
Open

Add support for proxy network #28

cshuitao opened this issue May 14, 2024 · 10 comments
Labels
enhancement New feature or request nice to have An issue that is not a priority for us, but for which we welcome pull requests

Comments

@cshuitao
Copy link

Can this script access Telegram through a proxy network?

@MsFGz
Copy link

MsFGz commented May 15, 2024

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

I also want to ask this question

@hantconny
Copy link

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

@MsFGz
Copy link

MsFGz commented May 16, 2024

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

非常感谢

@GalenReich GalenReich added enhancement New feature or request nice to have An issue that is not a priority for us, but for which we welcome pull requests labels May 16, 2024
@GalenReich
Copy link
Contributor

GalenReich commented May 16, 2024

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 🎉

@GalenReich GalenReich changed the title Can this script access Telegram through a proxy network? Access Telegram through a proxy network May 16, 2024
@GalenReich GalenReich changed the title Access Telegram through a proxy network Add support for proxy network May 16, 2024
@MsFGz
Copy link

MsFGz commented May 17, 2024

在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
Copy link

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

@MsFGz
Copy link

MsFGz commented May 17, 2024

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

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

@79946345
Copy link

79946345 commented May 22, 2024

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
Copy link
Contributor

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nice to have An issue that is not a priority for us, but for which we welcome pull requests
Projects
None yet
Development

No branches or pull requests

5 participants