3

在 Ubuntu 上,

[guy@guy-laptop tmp]$ sudo /etc/init.d/tor status
tor is running
[guy@guy-laptop tmp]$ sudo /etc/init.d/polipo start
Starting polipo: /usr/bin/polipo already running -- doing nothing
polipo.

还:

$ python -c 'import urllib; print urllib.getproxies()'
{'ftp': 'ftp://127.0.0.1:8118/', 'all': 'socks://127.0.0.1:8118/',
'http': 'http://127.0.0.1:8118/', 'https': 'https://127.0.0.1:8118/',
'no': 'localhost,127.0.0.0/8,*.local'}

运行scrapy时,我得到:

错误:下载https://registration.example.com/login.fcc时出错:[失败实例:回溯(无帧失败)::[('SSL 例程','SSL23_READ','ssl 握手失败')]]

同时,FireFox 设法通过代理正确获取页面

任何帮助将不胜感激,谢谢,盖伊

4

1 回答 1

3

您是否尝试过通过代理链运行脚本?在 ubuntu 上安装:

:~$ sudo apt-get install proxychains

然后配置 /etc/proxychains.conf 文件以使用 TOR (socks4/5)。

# defaults set to "tor"

袜子4 127.0.0.1 9050

然后你可以通过 TOR 运行任何东西

:~$ proxychains scriptwhatever.py target

一旦你知道 TOR 工作正常,我建议在 proxychains.conf 文件中使用安静模式。

# 安静模式(库没有输出)。
静音模式

于 2012-02-17T08:39:06.847 回答