The RoLLing cOde

Rumor, crap and –un–original

Convert adblock rule list to regular expressions

leave a comment »

Here’s the script convert EasyList and ChinaList to regex lines, which may be used in some web browsers or proxy programs.

#!/bin/sh

ADLIST=”http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt http://easylist.adblockplus.org/easylist.txt”

echo -n > /tmp/adblock.txt

for URL in $ADLIST

do

    echo Fetching $URL …

    curl $URL | grep -v ^$ | grep -v # | grep -v ^[!|@] | grep -v \$ | sed ’s/./\./g’ | sed s/*/.*/g | sed ’s/|/\|/g’ | grep -v ‘Adblock Plus 1′ >> /tmp/adblock.txt

done

Note this will generate >1000 regexp lines, which might impact performance of your web browser.

Written by freewizard

2009-07-04 at 17:27

Posted in Crap

Tagged with

Leave a Reply


To prove you're a person (not a spam script), type the answer to the math equation shown in the picture.
Anti-spam equation