HTTP Proxy to Socks5
- 安装
python-proxy
pip3 install pproxy
- 运行
orpproxy
pproxy -l http://:808 -r socks5://127.0.0.1:16778 -vv
在scrapy
中使用pproxy
- Scrapy with HTTP Proxy Create middleware (
middlewares.py
)class ProxyMiddleware(object): def process_request(self, request, spider): request.meta['proxy'] = "http://127.0.0.1:8181"
- Assign it to
DOWNLOADER_MIDDLEWARES
(settings.py
)DOWNLOADER_MIDDLEWARES = { '<PROJECT_NAME_HERE>.middlewares.ProxyMiddleware': 350 }