cundi / blog

push issues as a blog
2 stars 0 forks source link

使用Privoxy过滤广告 #16

Open cundi opened 8 years ago

cundi commented 8 years ago

原始链接:http://mattiascc.github.io/blog/2015/02/22/privoxy-and-adblock-plus-filters/

Privoxy and Adblock Plus Filters

If you want to block ads and tracking scripts using Adblock Plus and privoxy, just follow the simple steps below.

Adblock Plus for Android could be a potential option, while privoxy has the benefit it doesn’t require any software installed on the phone and once configured can be used by any device in your network, including smartphones and computers. Privoxy can perfectly run on a raspberry-pi or a laptop sitting in your LAN, ..yes, even a Windows machine. You can make your workplace ads and tracking free, sharing the proxy among your pals.

Adblock Plus filters can be converted to be used by privoxy, thanks to skroll’s script. In addition to the ads blocking lists it is strongly recommended to add the EasyPrivacy list.

Android Proxy

To configure the proxy in Android, just long-touch a Wireless connection and select Modify network. Instructions

Linux

Download & Convert Adblock Easylist filters

# /etc/privoxy is assumed to be your privoxy configuration directory

wget https://raw.githubusercontent.com/skroll/privoxy-adblock/master/privoxy-adblock.sh

chmod +x privoxy-adblock.sh

./privoxy-adblock.sh -d -p /etc/privoxy/ -u https://easylist-downloads.adblockplus.org/antiadblockfilters.txt \
                                         -u https://easylist-downloads.adblockplus.org/easylist.txt \
                                         -u https://easylist-downloads.adblockplus.org/easyprivacy.txt

cd /etc/privoxy

echo actionsfile antiadblockfilters.script.action >> config
echo filterfile antiadblockfilters.script.filter >> config
echo actionsfile easylist.script.action >> config
echo filterfile easylist.script.filter >> config
echo actionsfile easyprivacy.script.action >> config
echo filterfile easyprivacy.script.filter >> config

If you like to log the requests blocked by privoxy, enable the following configuration line:

Enable blocked requests logging

vi /etc/privoxy/config

# debug 1024 < uncomment this line, save & quit

service privoxy restart

Have fun. You’ll be amazed by the amount of tracking scripts that are blocked for any common web page.

Windows

The same would work in privoxy for Windows, just add the following lines to the privoxy config file:

Copy & Paste

actionsfile antiadblockfilters.script.action
filterfile antiadblockfilters.script.filter
actionsfile easylist.script.action
filterfile easylist.script.filter
actionsfile easyprivacy.script.action
filterfile easyprivacy.script.filter

Links

skroll’s privoxy Adblock script EasyList

Posted by mattia Feb 22nd, 2015 10:28 pm adblock, android, privacy, privoxy