AdSweep

Enjoy an ad-free web browsing with AdSweep

Update: Due to lack of time, lack of technical support, and despite repeated requests with no feedback, I sadly had to discontinue the AdSweep project. You can still download it and tweak the source code to your needs if you know how to do so. I will no longer remove ads on demand. Thanks to those who have helped me.

Download AdSweep

  Chrome Extension - AdSweep Opera AdSweep User Script Greasemonkey AdSweep
Browser: Chrome/Chromium/Iron Opera Firefox*
Extension: AdSweep.crx - -
User script: AdSweep.user.js AdSweep.js AdSweep.user.js

* partial support, see below.

Download other related browser addons for Chrome and Opera below.

Introduction

AdSweep is a small addon that aims to hide advertising from the web pages you visit like Adblock. In technical terms, AdSweep is a user javascript that defines CSS rules based on the web site you are visiting to hide elements of the page that show advertisements. If you want to use Opera's Content Blocker in addition to AdSweep, you can use my adblock list.

AdSweep is designed for standard-compliant web browsers such as Opera, Google Chrome, Chromium, Iron, Mozilla Firefox 3.1+ or Apple Safari. It works better and faster with Opera and now with Google Chrome. It is a work in progress, more and more web sites are added over time, and if you have basic CSS skills, you can take part and help make the web a cleaner place. To help me out, you can get in touch with me by email.

See for yourself

See how powerful AdSweep is to clean web sites. With advanced CSS pseudo classes to select unwanted elements of the page, AdSweep can remove any advertisement on a page. AdSweep applies filters that identify ads based on common patterns that are specific to banner ads (name of ads, dimensions of banners, anchor tags linking to known advertising servers, combination of tags and properties, etc...). We can also add custom rules based on the current web site to remove unconventional advertisements (usually advertisements that don't go through an advertising network like Doubleclick or Overture). And icing on the cake: AdSweep's flexibility allows regular styling to fix web sites, also on a per-site basis, when needed. Of course, these enhancements and hide-rules are shared among all users, and many users contribute providing fixes and hide-rules.

To compare AdSweep with other popular ad blockers, take a look at Distrowatch for instance. Distrowatch uses unconventional ad patterns because the webmaster places a number of ads that belong to small partners, which means the ads are not easily recognizable from a technical standpoint.

No ad blockerPrivoxy
Adblock PlusAdSweep

Basically, traditional ad blockers will only block a few ads, leaving sometimes the placeholder empty, as if there were a problem loading the images. AdSweep gets rid of all ads and leaves the page clean.

Installation

To install AdSweep download the user script (above) in a directory of your choice (Thanks to Mehmet Buyukozer for his instructions in Turkish).

When you're done, close your browser, reopen it and access www.adsweep.org, you should see a red notification in the upper-right corner of the page (only displayed on www.adsweep.org), saying AdSweep is installed. If you would like to see how AdSweep works, here's an example, with the Digg web site:

Using Opera (click to enlarge):

Opera Ad Blocker

Using Chrome (click to enlarge):

Google Chrome Ad Blocker

Schedule updates

To receive updates, download and install GetRight (there's a free version), click "Tools > Daily Downloads > Add...".

Click "OK", and click the "Go All" button to test the update system. Then, click the "OK" button to close the dialog window. GetRight will update AdSweep as scheduled.

If you're a power user, and if you prefer a more light-weight application with no GUI, Gill suggested to use wget instead. Download and install the "Complete package, except sources", install wget to the default location, create a Scheduled Task which will run:

"C:\Program Files\GnuWin32\bin\wget.exe" -N -P "C:\Path_To_Your_User_Directory\User Scripts" http://www.adsweep.org/AdSweep.user.js

Make sure you change to your user path accordingly. This job will download the Adsweep.user.js file and place it in your scripts folder. It will only download and overwrite the Adsweep.user.js file if the version on the server is newer than the version in the scripts folder.

If you use Linux or Unix, you can also schedule updates using a Cron job. For assistance, please ask on the Linux Question forum or on the FreeBSD forum.

Configuration file for Opera

The latest version of AdSweep accepts a custom settings file for you to use your own configuration. The source code of the settings file if self-explanatory. It is an optional file that only works with Opera (Chrome doesn't support it yet). You'll have to place the file in the same directory as your user scripts. Please share your hide-rules whenever you think they might help others get rid of advertisement.

Announcements & Mailing lists

If you want to receive news about AdSweep by email, you can sign up below. You will not receive a lot of emails, I promise.

Name: E-mail:

If you would like to discuss about AdSweep, you can subscribe to the mailing list where community members can participate and ask for support.

Contribution

If you like AdSweep, AND if you need web hosting, please consider Dreamhost. I have tried several web hosting companies and overall, I like Dreamhost a lot. When you sign up at Dreamhost using this link, they will reward me financially at no additional cost for you. Thanks in advance!

If you have some time, AND if you know some CSS, you can submit web sites and their respective selectors to be hidden to my email address. All selectors should be separated by commas, with no spaces. For instance:

digg.com: #block_ad_msft,.item_ad_image,.msad,#comments_ad_msft,.comments_ad_image

Please pay close attention to selectors you send so that my own review be faster. You can brush up CSS selectors and use advanced selectors such as those:

E[foo="bar"]
E[foo~="bar"]
E[foo^="bar"]
E[foo$="bar"]
E[foo*="bar"]

img[width="100"][height="50"]

body>table:nth-child(3)>tbody>tr:last-nth-of-type(2)>td:nth-of-type(4)

Last, but not least, you are welcome to participate financially. I know you can't donate everywhere, but having a cleaner web is pretty cool to have. We're not going to be able to clean all web sites, but we'll clean in priority the domain names you ask to clean so that the most visited web sites look nicer and load faster. If you like the idea and would like to help your way, here's my Paypal account for donations: contact@adsweep.org - Thank you.

Why is it so difficult to add hide-rules in AdSweep?

Regarding the complexity of AdSweep, I'm aware of it, but this is why AdSweep is able to be so efficient and versatile at the same time. It is not an URL blocker. Both are complementary, one blocks URLs, the other hides placeholders. There is no way to make AdSweep easier to understand, because of the technical requirements. It's a little like an antivirus. There's no way to add manually a virus to a virus database without resorting to (much more advanced) programming. So the only way is asking either me or a middleman who knows programming.

For instance, there are several ways to block an image on a site, it really depends on the situation. You can select all images of the document, count from 0 until you find the image in the group of images. You can also identify it using an ID. If the image has a class, you can use the class name, only if no other image has the same class name. But many times you have to hide the image using its siblings or parent nodes if no other solution is possible (ie: for dynamic content). Here's a sample code that I use to remove Kontera ads:

if(document.getElementsByTagName("A")){
	var anchorTags=document.getElementsByTagName("A");
	for(var a=0;a<anchorTags.length;a++){
		for(var x=0;x<anchorTags[a].attributes.length;x++){
			if(anchorTags[a].attributes[x].nodeName.toLowerCase()=='class') {
				if(anchorTags[a].attributes[x].nodeValue=='kLink'){
					var textString=anchorTags[a].childNodes[0].childNodes[0].innerHTML;
					var newNode=document.createElement('SPAN');
					newNode.innerHTML=textString;
					anchorTags[a].parentNode.insertBefore(newNode,anchorTags[a]);
					anchorTags[a].parentNode.removeChild(anchorTags[a]);
				}
			}
		}
	}
}

There's no way to make it more simple. It's not as easy as blocking an URL...AdSweep isn't meant to compete with URL blockers, but it is more comparable to the Element Hider, Privoxy or bFilter. Opera's Content Blocker (that I use too), or HostMan are good URL blockers. They serve different purposes (blocking URLs vs. hiding content). If you want to use Opera's Content Blocker in addition to AdSweep, you can use my adblock list. There are other lists of common ad patterns on the web, I see several problems with some of them (and this is why I decided to build my own list), it is that they're just lists of ad-selectors found on the web. They don't obey to heuristics, so they don't often apply to unknown web sites. They mainly apply to web sites the author has visited. Also, the lists are quite large, and we have to try to keep the list as small as possible. And, a number of selectors generate false positives, e.g. img[width="728"][height="90"] (this is too aggressive). Other tools allow simple selection of elements on a page; the problem is that with simple selectors such as div#sponsored-links, the selection is more vulnerable to source-code change than either an advanced selector with a pseudo class, or (even better), javascript selection based on advanced patterns or regular expressions.

Other browser addons

(Use .user.js file extensions for Chome or Mozilla browsers; use .js extension for Opera)

The AdSweep logo was created by gg3po and is released under the terms of the GPL.