Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Get rid of YouTube ads


  • Please log in to reply
15 replies to this topic
col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015
Folks,

The little adverts that appear on the bottom of YouTube clips irritate me. I never actually look at them for more time than is required to hit the X at the top right corner, so I wrote this script to do it automatically.

It's a very simple script, but I searched the forum and couldn't find that anybody else had posted one to do the job, so maybe you'll like it. It seems to work every time, though it may need a bit of massaging to work on your PC. I'll tell you what to do. If you leave the ad on screen for a period, it remains there, but goes dim. This script doesn't recognise the dimmed version, but it doesn't need to, as it deals with the ad within half a second - long before it goes dim.

I run an AHK script all the time, so I just added this to the bottom of that script, so I can start it with a hotkey.

SetTitleMatchMode 2  ; this is set for the entire script file

; Other code and utilities inserted here

#u::
; get rid of adverts on Youtube
ifwinactive, YouTube
  Settimer, ScanTime, 500
Return  

ScanTime:  ; Runs every half-second
{ ifWinNotActive, YouTube
  { Settimer, ScanTime, off
     SoundBeep  ; beeps twice to let you know the script is exiting
     Sleep 200
     SoundBeep
     Return
  }
  ImageSearch, AdButtonX, AdButtonY, 450, 500, 830, 650, C:\Pix\AdCross.bmp
  if(ErrorLevel = 0)
  { AdButtonX += 6
     AdButtonY += 8
     MouseGetPos, AdX, AdY ; Read the mouse position
     Click %AdButtonX%, %AdButtonY%
     MouseMove %AdX%, %AdY% ; Put the mouse back where it was
  }
  Return
}

As you see, there's not much to it.
When #u is pressed, it checks that YouTube is active, then starts routine ScanTime, which runs twice per second.

The routine checks that Youtube is active, and exits if it is not, it exits with a "Beep...Beep" to let you know it's closing.
If YouTube is up, the routine scans the bit of the screen where the advert appears. The object of the scan is an image, on my disk at ...

C:\Pix\AdCross.bmp

On my screen, the area scanned is from top-left ( 450, 500 ) to bottom right ( 830, 650 ). This is something you may have to change, depending on your screen display.

The image that it is searching for is the picture of the "X" that appears at the top right of the advert. If it finds it, it moves the mouse to the middle of the cross and clicks it.

I'm sorry, Folks, I don't know how to attach the image file, so you'll have to make it yourselves. It's easy peasy!

Display YouTube and wait for the advert to come up. Hit the PrtSc key.
Bring up MS Paint
Past the screen image into Paint. Hit Esc to get rid of the selection.
Magnify the cross several times - to the maximum is good.
Hit the Select tool and make a selection box around the cross.
Warning: The cross has a dark surround, which you don't want, as that part is semi-transparent, and may be a different colour on your screen. All you want is the cross itself, with a one-pixel, light coloured surround. The interior of the cross is colour=0x7F7F7F, and the surround is colour=0xDFDFDF. You don't want anyrthing outside of that.
When you have selected only the required part, hit Ctrl-C to copy it.

Exit Paint, and don't bother to save it.

Start Paint again.
The screen is white, but it is way too big. Move to the extreme bottom right corner of the white screen (you may have to use the scroll bars) and click on the resize button, and drag it to the top left corner, so that the white screen is only about a pixel big.
Now paste the image of the cross (which is being held in scratchpad).
Save the image as a .bmp file. In my case, I saved it to
c:\Pix\AdCross.bmp
If you save it somewhere else, change the path in the script.
As a guide, my file contains 450 bytes.

That's it - if you made the image right, it should work OK.

When you go onto YouTube, press #u, and the script will exit when you exit YouTube.

I apologise if this is a bit like sucking eggs, but I wanted it to be understandable by newbies as well as the geniuses that inhabit this site.

xxOrpheus
  • Members
  • 134 posts
  • Last active: Jul 21 2014 12:15 AM
  • Joined: 27 Sep 2011
This is a great idea :D Good job, I'll test in a minute :)

  • Guests
  • Last active:
  • Joined: --
...or just use Adblock Plus?

xxOrpheus
  • Members
  • 134 posts
  • Last active: Jul 21 2014 12:15 AM
  • Joined: 27 Sep 2011

...or just use Adblock Plus?

Adblock does not block the ads he is talking about.

  • Guests
  • Last active:
  • Joined: --
It does for me. What Filter Subscriptions are in-use?

I use YouTube completely Ad-Free, free from ads inside & outside the video.

I even add my own extra filter to remove "watermarks" (in the bottom right corner of the video)...like YouTube, VEVO, etc...that the Filter Subscription misses.

col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015
Guest, "What Filter Subscriptions are in-use? "

None. Well actually, I don't understand the question. You probably know a lot more about YouTube than I do.

"I use YouTube completely Ad-Free"

How do you do it? You surely don't (shock, horror!) pay money?

  • Guests
  • Last active:
  • Joined: --

None. Well actually, I don't understand the question.

..."Filter Subscriptions" are what make Adblock Plus, well, actually do anything. Without any "Filter Subscriptions"...or other (manually added) ad-blocking rules, you wouldn't be telling ABP to anything, which would be pointless, more info below.

How do you do it?

...I'm so glad you asked! Like I said above, I use Adblock Plus, which is an Addon for the Firefox web browser. However, simply installing ABP (short for Adblock Plus) won't actually DO anything (by itself), you must tell ABP what ads it should block & the simplest way of doing that is to add a Filter Subscription. ABP will also prompt you to add your first subscription when you install it. YouTube is unbearable without Firefox & ABP!...(& a Filter Subscription).

col_mik
  • Members
  • 171 posts
  • Last active: Aug 29 2015 03:29 PM
  • Joined: 28 Jun 2015
Guest, Thank you. I'll have a look at it.
In the meantime, I'm quite pleased with my script! :-)

klenker
  • New members
  • 1 posts
  • Last active: Aug 19 2015 01:39 AM
  • Joined: 18 Aug 2015

..."Filter Subscriptions" are what make Adblock Plus, well, actually do anything. Without any "Filter Subscriptions"...or other (manually added) ad-blocking rules, you wouldn't be telling ABP to anything, which would be pointless, more info below.


...I'm so glad you asked! Like I said above, I use Adblock Plus, which is an Addon for the Firefox web browser. However, simply installing ABP (short for Adblock Plus) won't actually DO anything (by itself), you must tell ABP what ads it should block & the simplest way of doing that is to add a Filter Subscription. ABP will also prompt you to add your first subscription when you install it. YouTube is unbearable without Firefox & ABP!...(& a Filter Subscription).

 

 

Ahh I disagree. There is no Adblock plus filter subscription for youtube adverts. I have no idea what this guy is talking about, and as he refuses to say which filter he is using, I say he's just getting people to install adblock plus.

I've looked into this, there is no adblock filter subscription. it just doesnt exist.

Hence why I am looking into AHK to do this. And this sadly doesnt do it.

:/



Necroforger
  • Members
  • 8 posts
  • Last active: Jun 09 2018 02:54 AM
  • Joined: 14 Aug 2015

AdBlock works fine for me. I'm running Google Chrome and haven't seen any ads at all.

Although, this could be useful If I run into problems in the future with AdBlock.



gregster
  • Members
  • 283 posts
  • Last active: Nov 09 2015 03:08 AM
  • Joined: 19 Mar 2009

Ahh I disagree. There is no Adblock plus filter subscription for youtube adverts. I have no idea what this guy is talking about, and as he refuses to say which filter he is using, I say he's just getting people to install adblock plus.

I've looked into this, there is no adblock filter subscription. it just doesnt exist.

Hence why I am looking into AHK to do this. And this sadly doesnt do it.

:/

 

I am using the Adblock Plus plugin in Firefox with the original filters. With that, there are no ads at all on Youtube for me...



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

i got Ublock on chrome installed with the normal filter and it works gr8 no ads


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

Just installed ABP based on this thread. Shall see! ;)



Guest10
  • Members
  • 1216 posts
  • Last active: Oct 30 2015 05:12 PM
  • Joined: 27 Oct 2012

ABP rules! ;) http://blogs.wsj.com...=trending_now_1

3:11 pm September 1, 2015
David Ecale wrote:

YAWN! Firefox blocks them with NoScript and AdBlocker+ ... A little late to the party, GOOGLE.



scriptor
  • Members
  • 668 posts
  • Last active: Feb 15 2016 01:02 AM
  • Joined: 20 Jun 2013

I'm not sure if anyone is aware of a small app called Privoxy, but I've been using it for a few years now and I haven't seen a single ad on my system anywhere at any time. Not Youtube, not message forums, not anywhere. I've honestly forgotten that the internet tries to impose advertisements on us at all, because it works that well. If anyone is interested, just download it, install it and then follow the instructions on how to use it. I use Google Chrome and enabled the use of a proxy server (as requested by Privoxy), and then just changed the few settings that were required. All ads- gone - totally. No more 30 second commercials before a Youtube video... and no signing into Google (which AdBlock needs you to do, I believe).  This works 100x better than Adblock, that I know - I've tried both.  I haven't noticed a thing regarding ads on my system in years. Here's the link for those that want to try it out:

 

http://www.privoxy.org/