Python/Selenium如何使用未发现的代理人使用代理人

发布于 2025-01-19 03:59:53 字数 810 浏览 5 评论 0原文

每当我尝试使用未发现的魔术师的代理人时,它就不起作用,也不是我的IP。 当我使用普通的WebDriver时,它可以很好地工作。

from selenium import webdriver
from time import sleep


ip_port = "ip:port"

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % ip_port)
driver = uc.Chrome(use_subprocess=True, chrome_options=chrome_options)

driver.get('https://www.myexternalip.com/raw')
sleep(999)

如何使代理人与未发现的Chromedriver一起使用?

这是网站 https://www.myexternalip.com/raw : 使用未检测到的ChromeDriver(给出我的实际IP)

“

感谢您的帮助。

whenever I try to use a proxy with undetedted-chromedriver, it just doesn't work and diplays my ip.
When I use the normal webdriver, it works perfectly.

from selenium import webdriver
from time import sleep


ip_port = "ip:port"

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % ip_port)
driver = uc.Chrome(use_subprocess=True, chrome_options=chrome_options)

driver.get('https://www.myexternalip.com/raw')
sleep(999)

How can I make the proxy work with undetected chromedriver?

This is the site https://www.myexternalip.com/raw :
With undetected chromedriver (gives my actual ip)

ip adress

Thanks for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拥抱我好吗 2025-01-26 03:59:53

让它工作:

chrome_options = Options()
chrome_options.add_argument('--proxy-server=ip:port')
driver = uc.Chrome(options=chrome_options)
driver.get('https://www.myexternalip.com/raw')

Got it work with:

chrome_options = Options()
chrome_options.add_argument('--proxy-server=ip:port')
driver = uc.Chrome(options=chrome_options)
driver.get('https://www.myexternalip.com/raw')
鯉魚旗 2025-01-26 03:59:53

您可以使用 Chrome 扩展程序通过代理更改您的 IP。
例如,我使用 SwitchyOmega。然后我在扩展程序中设置代理,它工作得很好。

You can use a chrome extension to change your IP using a proxy.
For example I use SwitchyOmega. Then I set the proxy inside the extension and it works completely fine.

摇划花蜜的午后 2025-01-26 03:59:53

我假设您在服务器上为您的计算机设置了绿色标志,因此您不需要输入服务器的登录名和密码:

options.add_argument('--proxy-server=185.195.81.152:12573') 
options.add_argument('--proxy-server=socks5://185.195.81.152:12573') # socks5
options.add_argument('--proxy-server=https://185.195.81.152:12573') # https

还建议使用:

options.add_argument('--proxy-bypass-list=<-loopback>')

如果您没有将您的计算机IP设置为绿色标志到服务器,那么您还需要提供登录名和密码:

options.add_argument('--proxy-server=proxy_username:proxy_password@proxy_ip:proxy_port')

I assume you set up a green flag for your machine on your server, so you don't need to enter the login and password for the server:

options.add_argument('--proxy-server=185.195.81.152:12573') 
options.add_argument('--proxy-server=socks5://185.195.81.152:12573') # socks5
options.add_argument('--proxy-server=https://185.195.81.152:12573') # https

also suggest using:

options.add_argument('--proxy-bypass-list=<-loopback>')

If you didn't green flag your machines IP to the server, then you'll need to provide the login and password as well:

options.add_argument('--proxy-server=proxy_username:proxy_password@proxy_ip:proxy_port')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文