WebMonitor
WebMonitor copied to clipboard
因为众所周知的原因,麻烦给个选项,能够设置代理地址
抓取 日本亚马逊的时候需要代理。。。 麻烦添加以下功能。
我自己魔改了。。。
我自己魔改了。。。
可以PR
试试 Docker 容器的启动代理配置?
试试 Docker 容器的启动代理配置?
不起作用,无论是config.json还是直接docker run --env都没用。
搜索了一下 https://stackoverflow.com/questions/14699718/how-do-i-set-a-proxy-for-phantomjs-ghostdriver-in-python-webdriver
from selenium import webdriver
from selenium.webdriver.phantomjs.service import Service as PhantomJSService
phantomjs_path = '/usr/lib/node_modules/phantomjs/lib/phantom/bin/phantomjs'
# monkey patch Service temporarily to include desired args
class NewService(PhantomJSService):
def __init__(self, *args, **kwargs):
service_args = kwargs.setdefault('service_args', [])
service_args += [
'--proxy=localhost:8080',
'--proxy-type=http',
]
super(NewService, self).__init__(*args, **kwargs)
webdriver.phantomjs.webdriver.Service = NewService
# init the webdriver
self.driver = webdriver.PhantomJS(phantomjs_path)
# undo monkey patch
webdriver.phantomjs.webdriver.Service = **PhantomJSService**
但是不知道怎么才能让界面上有这个选项。
这个怎么使用?