YouTube Ads – How to Disable Advertisements Before Videos

adsyoutube

I don't mind the advertisements on the right side or the small banner inside YouTube videos, but the advertisements shown before a video is played are really annoying.

How can I disable those advertisements?

I know I can install Adblock Plus for Firefox, but that also disables all other advertisements which is not fair for webmasters. If that's the only way to get rid of the advertisements, Google seriously did something wrong.

Best Answer

Based on the extension as posted by @phwd, I've created a simple script that is designed to do exactly one thing: remove in-video advertisements.

Simple installation instructions for Firefox

  1. Go to https://addons.mozilla.org/firefox/addon/greasemonkey/ and press the green installation button
  2. After installation of the add-on, restart Firefox
  3. Open http://lekensteyn.nl/files/Remove_in-video_Youtube_adverts.user.js and press the Install button.
  4. Profit!

Other browsers

Instructions for installing this script across various browsers can be found on https://stackapps.com/tags/script/info

Firefox with Noscript

If you're using Firefox and have NoScript installed, you can use the below surrogates. You have to add two settings to about:config, both of type string.

  1. Key: noscript.surrogate.removeVideoAdsYoutube.sources
    Value:

    !@*.youtube.com

  2. Key: noscript.surrogate.removeVideoAdsYoutube.replacement
    Value:

    (function(){try{var o=ytplayer.config.args,i;for(i in o){if(o.hasOwnProperty(i)&&/^(afv_)?ad/.test(i))delete o[i]}}catch(e){}var a=document.getElementById("movie_player");if(a){var b=a.cloneNode(!0); b.setAttribute("flashvars", a.getAttribute("flashvars").replace(/&(afv_)?ad[^&]+/g,"")); a.parentNode.replaceChild(b,a)}})()

If you want to make your own surrogates, have a look at http://hackademix.net/2011/09/29/script-surrogates-quick-reference/

UPDATE (02/24/14): fixed noscript surrogate code. Greasemonkey script still broken at this date.