Suggestion: Enabling YouTube Ads Depending on Channel

Various discussions related to Adblock Plus development
SNLThe_Office
Posts: 2
Joined: Tue Jan 01, 2013 5:55 am

Suggestion: Enabling YouTube Ads Depending on Channel

Post by SNLThe_Office »

A helpful feature that AdBlock Plus could have would be the ability to enable ads before YouTube videos on certain channels. The user would be able to make a list of the channels that they are willing to see ads on, and AdBlock would block the ads on the other channels. This would be helpful for those who believe that certain channels deserve the monetary compensation they receive from AdWords and they are willing to watch ads for them while blocking the ads on the channels that the user would prefer not to see ads on.
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by lewisje »

ABP currently does not monitor HTTP responses, only requests, and there is nothing in an HTTP request on YouTube to determine what channel a video is associated with; you only have the URL (which has no info. whatsoever about channel), the referer (which can vary), and the type of request (which will always be "object-subrequest" in our case).

Now you can already enable YouTube ads per video, but without monitoring HTTP responses (a massive undertaking that IIRC Palant & Co. are opposed to), you can't enable ads per channel.
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
blank

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by blank »

The <span itemprop="author"> tag contains the channel url, so adblock could check this on any youtube video page.
blank

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by blank »

Being unregistered, I can't edit posts. The following element hiding rule hides the element containing the channel URL
youtube.com##span[itemprop="author"]>link[href="CHANNELURL"]

If there were a way to exempt or block the whole page when an element hiding rule matches within the page, this is sufficient to accomplish the suggestion. This would also allow blocking ads in iframes based on an element the frame contains.
auserofabp

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by auserofabp »

blank wrote:If there were a way to exempt or block the whole page when an element hiding rule matches within the page, this is sufficient to accomplish the suggestion. This would also allow blocking ads in iframes based on an element the frame contains.
That defeats the purpose of adblock because the page would need to load for ABP to determine whether it should be blocked. I'm pretty sure most users don't want that.

If your suggestion is limited to the top-level page, it's a bit more realistic. Still, you would probably need to select the element via Javascript, which works much differently from CSS. If ABP can be disabled by other addons, you could write one... :)
blank

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by blank »

It would only need to load the html, so the browser could load the page, then adblock plus could check if it should be disabled, and if so, disable itself, then load the other resources that adblock plus would otherwise block.
auserofabp

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by auserofabp »

blank wrote:It would only need to load the html
Right, but if we're not talking about the top-level page then that's more than enough to track users in a way that ABP currently can prevent.
blank wrote:so the browser could load the page, then adblock plus could check if it should be disabled, and if so, disable itself, then load the other resources that adblock plus would otherwise block.
I'm guessing from forum/viewtopic.php?f=4&t=5977 that the ABP developers don't want to implement this, which is why I suggested writing your own addon. If disabling ABP via another addon isn't possible, you could fork ABP, but there you would have to decide whether that's more of a pain than clicking "Disable on this page only" once for each video on a channel.
blank

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by blank »

If by top-level page, you mean page that the user directly requested, as opposed to homepage of a site, then only the top-level page would need to be loaded to implement this (though hiding iframes, etc. would require checking those as well)
anon0

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by anon0 »

Hi, I too would like to support some of the YT channels. Hell, there are some that are so good, I'd even watch the god-damn 30 second ads before the video that you can't skip most of, provided it'll bring a cent to the author(s).
schippi

Post by schippi »

with greasemonkey you can setup exactly what you want though im sure there are much more elegant solutions

greasemonkeyscript:

Code: Select all

var u = window.location.href;
if(u.search("user=") == -1){
	var cont = document.getElementById("watch7-user-header").innerHTML;
	var user=cont.replace(/.+\/user\//i,'').replace(/\?(?:.|\s)*/m,''); 
	window.location = u+"&user="+user;
}
the you can whitelist the URL by adding a rule for each user:

Code: Select all

@@|http://www.youtube.com/watch*user=TotalHalibut
schippi

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by schippi »

sry, forgot to put in the header of the monkey script

Code: Select all

// ==UserScript==
// @name        Youtube opt in Ads per channel
// @namespace   schippi
// @include     http://www.youtube.com/watch*
// @version     1
// ==/UserScript==

var u = window.location.href;
if(u.search("user=") == -1){
	var cont = document.getElementById("watch7-user-header").innerHTML;
	var user=cont.replace(/.+\/user\//i,'').replace(/\?(?:.|\s)*/m,''); 
	window.location = u+"&user="+user;
}
hadnafeesn
Posts: 1
Joined: Wed Sep 25, 2013 12:44 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by hadnafeesn »

I wonder if any reader of the forum who also owns one such instrument may kindly provide a copy of it. That would be much appreciated.
ashleyco
Posts: 1
Joined: Thu Sep 26, 2013 4:48 am
Location: USA
Contact:

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by ashleyco »

I too would like to support some of the YT channels.
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by mapx »

as I saw some comments on adblock plus twitter channel, it seems the devs are thinking to implement such a request for YT
Dr.Bones

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Post by Dr.Bones »

Thanks a Bunch schippi!

I actually wanted to support TotalBiscuit :). Your script inserted into Tampermonkey did the trick. I just needed a while to figure out to whitelist stuff in ABP you just add a filter :oops: . The only thing i needed to change was the last line to actually change the href property of the window.location element. For some reason it would work manually but not in a tampermonkey script. The script below is the one that worked for me. All credits go to schippi

Code: Select all

// ==UserScript==
// @name        Youtube opt in Ads per channel
// @namespace   schippi
// @include     http://www.youtube.com/watch*
// @include     https://www.youtube.com/watch*
// @version     1
// ==/UserScript==

var u = window.location.href;
if(u.search("user=") == -1){
	var cont = document.getElementById("watch7-user-header").innerHTML;
	var user=cont.replace(/.+\/user\//i,'').replace(/\?(?:.|\s)*/m,''); 
	window.location.href = u+"&user="+user;
}
And dont forget to add the filter to AdBlock Plus!
Post Reply