PDA

View Full Version : Improved Ad-Blocking


oleandros
2006-04-27, 07:58 AM
I love Omniweb's feature set, but have gotten spoiled in Safari with PithHelmet. So, can their be a way to either work with the developer of PithHelmet to get it to work with Omniweb.

OR

It looks like the Ad Blocking uses regular expressions (like Firefox's AdBlock) so could there be a way to import a block list (like Filterset.G) to Omniweb so one doesn't have to add them one at a time?

Thanks
'

Flounder
2006-04-27, 01:35 PM
It would be nice to have the functionality built in but also there are CSS style sheets that can do this also... gotta check out (the irony I know) pimpmysafari.com and under ad blocking there should be a link to where you can dl a CSS to use and then in OW's prefs select that CSS sheet as default

JKT
2006-04-27, 01:45 PM
If I remember correctly, CSS ad blocking works by not displaying the images, but does nothing to stop them being downloaded. OmniWeb's ad blocking prevents the images from ever being downloaded in the first place. Not that this distinction would matter to most but it might help for some to know.

mjuengling
2006-04-27, 01:47 PM
I'd prefer Privoxy (http://www.privoxy.org/). It runs with all browsers and is a very good ad blocker.

Zetetic
2006-04-28, 09:36 AM
I'm happy that OmniWeb's ad blocking prevents ads even been requesting (like PithHelmet or any generic proxy) but it'd be nice if the mechanism also did what PH does, without having to mess around with user style sheets, and prevents the removed ads from appearing on the page at all. I don't see the point of removing banner ads from the top, sides and bottom of the page if there's going to be a large placeholder there instead.

Chrysogonus
2006-04-28, 11:57 AM
I don't see the point of removing banner ads from the top, sides and bottom of the page if there's going to be a large placeholder there instead.
The trouble is that, sometimes, the page layout can get incredibly mangled when this is done (try using parts of Macworld.com with PithHelmet). However, I also wish that the placeholders were a bit prettier (maybe a transparent white instead of dark grey), and that collapsing could be a site preference.
Also, things would be much better if OmniWeb shipped with a better set of blocking rules (PithHelmet is a good example of this, or perhaps there could be a mechanism to automatically fetch the rules for Ad-block). Right now, one has to do quite a bit of fiddling with the preferences before most ads are blocked.

jphaag
2006-04-28, 12:59 PM
I second Chrysogonus´ request on better rules out of the box. It would be great if you just had to tinker with the odd add instead of blocking them by the dozen.

thebrix
2006-05-01, 12:05 AM
The trouble is that, sometimes, the page layout can get incredibly mangled when this is done (try using parts of Macworld.com with PithHelmet). However, I also wish that the placeholders were a bit prettier (maybe a transparent white instead of dark grey), and that collapsing could be a site preference.
Also, things would be much better if OmniWeb shipped with a better set of blocking rules (PithHelmet is a good example of this, or perhaps there could be a mechanism to automatically fetch the rules for Ad-block). Right now, one has to do quite a bit of fiddling with the preferences before most ads are blocked.

Thirded ... the last thing you suggest is enhancement to the OW code (rather than an enhancement to data), but it would be a big win for a little code.

Allowing a blocklist to be imported from a text file, one blocking pattern per line, would enable some of the excellent blocklists already around, such as Filterset.G (http://www.pierceive.com/), to be imported.

FourOhFour
2006-05-03, 06:56 AM
It looks like the Ad Blocking uses regular expressions (like Firefox's AdBlock) so could there be a way to import a block list (like Filterset.G) to Omniweb so one doesn't have to add them one at a time?
Well, if you aren't scared of the command line, I wrote a quick and dirty script in perl to do it. http://fourohfour.info/stuff/owbli.pl.zip

Edit: This doesn't work. At least, not with Filterset.G. See next post.

Now, before I begin... This isn't even alpha-quality. It works for me. It might eat your cat. If it breaks, you get to keep the pieces. Don't blame me.

Download and decompress that, and stick it somewhere easy like Home.
Download the latest Filterset.G http://www.pierceive.com/filtersetg/ (2006-04-06a.txt currently) and stick it in the same place.

Quit OmniWeb.

In Terminal, run ./owbli.pl -x blocklist-backup.txt
This will create a backup of your current blocklist.

WARNING: The following command will delete your current blocklist! It will delete your current whitelist if the file you are importing has whitelist entries!
In Terminal, run ./owbli.pl -di 2006-04-06a.txt
(replacing the filename with the version of Filterset.G you downloaded)

There is currently no duplicate checking. If you know the file you are about to import does not duplicate anything that is currently in OmniWeb, you can omit the -d flag and the new entries will be added without deleting the existing ones. Just don't import a Filterset.G this way if you already have an older Filterset.G imported... I'd hate to think what so many duplicates would do to OmniWeb. No, I haven't tested it.

FourOhFour
2006-05-03, 12:22 PM
OK, I really should test things better before posting about them.

It appears while the regular expressions do appear in the block list in OmniWeb properly... they don't work. Nor do any other expressions in the list, including ones added by right clicking and selecting filter image. So... yeah. My guess is that one of the expressions in filterset.g confuses OW's regexp parser, but it's quite possible that my script malforms an expression somewhere...

Edit:

The good: Removing the first rule does allow the other rules to run.
(\Wadv|banner|promo)s?(\.(?!wunder)\w+\.\w{2,3}(\. \w{2,2})?/|\W\w*\d+x\d+\.)(?!banners) I don't see anything malformed there, so... yeah.

The bad: Filterset.G does not seem to work with OmniWeb anyway. Obvious things like doubleclick hosted ads are getting through, and it shouldn't be because of that first rule...

The ugly: I don't want to try to figure out why it doesn't work.

I give up. I really wanted the script so I could edit the block list in a text editor, which works fine. If someone else wants to figure out why filterset.g doesn't work... have fun. Maybe it's something I missed...

Chrysogonus
2006-05-05, 12:06 PM
So, perhaps it isn't as easy as it seemed. Thanks for trying anyway, FourOhFour.

FourOhFour
2006-05-05, 04:55 PM
So, perhaps it isn't as easy as it seemed. Thanks for trying anyway, FourOhFour.
Yeah. The import script works fine, as far as I can tell. The imported rules match the ones in Filterset.G... it's just that they don't work.

In working with my own rules, I've noticed that \d{2} didn't work. Most of Filterset.G's rules use the {} repetition shortcut.

(\d is any digit, \d{2} says any two digits. \d{2,4} would say two through four digits. \d{2,} says two or more. \d{2} is simple to expand, it becomes \d\d. \d{2,4} is the annoying case; it would become \d\d\d?\d?. \d{2,} would be \d\d+.)

Now, I don't think that's what broke that first rule, but it could be what's messing up the others. Any regexp experts around? Want to take a crack at a regexp that expands {}s in regexps? No, didn't think so...

Also, I've been notified that my link to the script didn't work. Oops, appears my host doesn't like .pl.gz files... I zipped it, and it downloads fine now. It may not be useful for importing Filterset.G, but it can export your rules into a nice file you can edit in a text editor or trade or whatever. They might even be compatible with Adblock, if you want to import them there. Haven't tried. ;-) http://fourohfour.info/stuff/owbli.pl.zip