How to set socks5 proxy in dryscrape python?

♀尐吖头ヾ 提交于 2019-12-23 00:46:09

问题


I want to scrap some website through tor.

Tor works uses socks proxy. I use dryscrape(library in python) as it also executes javascripts as well.

But I dryscrape can have only http proxy.

Is there some work around to set socks5 proxy for dryscrape or any other way out?

Thanks.


回答1:


I managed to do it using polipo. It can be installed on ubuntu from here.

Polipo can speak socks protocol as well as http protocol. Polipo can be configured to receive requests through http proxy and forward the same requests through socks5 proxy.

I used it as a front-end proxy server to dryscrape, for the back-end tor proxy server.

So, now I set dryscrape's http proxy 127.0.0.1(machine ip) and port no. 8118(default port no. for polipo). Now, Polipo forwards the same request to tor through socks5 proxy.

So, now I can use dryscrape to make request through socks5 proxy.

It is explained in more detail over here. ;)



来源:https://stackoverflow.com/questions/32425180/how-to-set-socks5-proxy-in-dryscrape-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!