1

抓取墙外的内容,

翻墙,

VPN,在程序中调用不方便;代理,比较方便。

有一台墙外的服务器,安装了shadowsocks

shadowsocks走的是socks5协议,

在程序中调用也不太方便,虽然shadowsocks是用python写的,但是在python3中使用socks5代理真是不方便……

如果能转成HTTP(s)协议就好了~

2

怎么办?

有个小工具Privoxy

实际上这个工具相对强大,这里只使用了几个简单的功能。

Privoxy is a non-caching web proxy with advanced filtering capabilities for enhancing privacy, modifying web page data and HTTP headers, controlling access, and removing ads and other obnoxious Internet junk. Privoxy has a flexible configuration and can be customized to suit individual needs and tastes. It has application for both stand-alone systems and multi-user networks.

编译安装,参考2.2. Building from Source

配置文件默认位于/usr/local/etc/privoxy

3

将socks5协议转成HTTP(s)协议

修改config,添加如下规则

forward-socks5 / xx.xx.xx.xx:1080 .

为了让外网用户也能访问该服务,修改

\#listen-address  127.0.0.1:8118
listen-address  0.0.0.0:8118

4

另外需要限制一下可以访问的域名

在添加两个配置文件blacklist.actionwhitelist.action

内容如下:

# blacklist.action
{ +block }
/

加过滤,也就是过滤所有域名。

# whitelist.action
{ -block }
instagram.com

减过滤,也就是允许访问instagram.com

config添加两行

actionsfile blacklist.action
actionsfile whitelist.action