Suggestion: Enabling YouTube Ads Depending on Channel

Various discussions related to Adblock Plus development

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby peppage » Sat Apr 26, 2014 6:23 am

The latest script change user to channel so you need to use

Code: Select all
@@||youtube.com/*channel=TotalHalibut$document
peppage
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby livingretro79 » Fri May 02, 2014 8:11 am

okay so i've been messing around with this for a couple of hours. i had first ran across the original script written by schippi that seemed to work for a long five minutes before it quite showing the ads on channels. have no clue why, or if it was an utter fluke that it ran for a short period. so i managed to find this site. i'm now trying the rewrite by vorondil "Expose Youtube Uploader Name in URL", i swapped out the script. now i have tried for example @@||youtube.com/*channel=ashens$document and @@||youtube.com/*user=ashens$document (though i know the new script calls for channel). well. if i load a channel, click the link, nada just pops up with the video and no ad. out of curiosity i hit F5 to refresh and it showed the script loaded and running and the ad now works. now i'm no coder, i don't pretend to be, and have had very little experience in teaching myself. but i'm curious why the script is only running on refresh rather than loading on the link. i really just want to support a handful of channels that i enjoy, as i would hope someone would do the same for myself. any ideas, maybe i'm not getting something or using this incorrectly. by the way i'm on chrome using tampermonkey. **oh and i have tried using the auto reload tab in tempermonkey as well.

edit: this does seem to work with videos that have in stream pop up ads, the little box that appears on screen during playback. i'll notice the script kick in and reload the page and show those ads. however it will only work for videos that have a commercial playing before the video if you refresh. eh. sorry for the length. just happened to notice that on a different channel i was watching that i had happened to add.
livingretro79
 
Posts: 1
Joined: Fri May 02, 2014 8:04 am

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby BeKind » Mon May 05, 2014 10:36 pm

I created an account just to suggest this.
I've been really wanting this feature for a long time now.
I hadn't bothered suggesting it in the past because, frankly, it seemed like a no-brainer feature that the devs probably thought of already.
I really, really hope I'll find this feature in a near-future Adblock release.
BeKind
 
Posts: 1
Joined: Mon May 05, 2014 10:22 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby DaJamsta123 » Mon May 19, 2014 10:05 pm

Vorondil wrote:When using the above javascript in GreaseMonkey for Firefox, it added a humongous text string in the URL-field that did not work. My guess is that the peopz behind Youtube have changed something recently, they tend to do that...

Anyhow, after some messing around with the script code I managed to get it to work for me, and I figured I'd share it with y'all.
I'm usually more of a C++/C#-programmer, and took myself the liberty of writing the code in a style i felt more legible. If I've made any serious Javascript faux pas, feel free to comment or alter as desired.

Code: Select all
// ==UserScript==
// @name        Expose Youtube Uploader Name in URL
// @namespace   schippi
// @description Used to expose a Youtube uploaders displayname in the URL
// @include     http://www.youtube.com/watch*
// @include     https://www.youtube.com/watch*
// @version     1.2
// @grant       none
// ==/UserScript==

// Credits go to Schippi and Dubious for doing the base work which I've modified here.

var url = window.location.href;
if ( url.search( "channel=" ) == -1 )
{
    if ( document.getElementById( "watch7-user-header" ) != null )
    {
        var channelNameContainer = document.getElementsByClassName("yt-user-name")[0];
        //var channelName = channelNameContainer.innerHTML;
        //The above 'channelName' is not used below. Could be an option instead of 'channelURL', but often contain spaces, and might not be unique.
       
        var channelURL = channelNameContainer.getAttribute("href");
        channelURL = channelURL.replace( '/user/', '' );
       
        //window.location.href = url + "&channel=" + channelName; //alterative for name insertion rather than channel-url.
        window.location.href = url + "&channel=" + channelURL;
    }
}


Vorondil out.


Tried using this one through tampermonkey in Chrome, with "channel=https://www.youtube.com/user/TotalHalibut", then adding the following to the AdBlock Plus filter "@@||youtube.com/*user=TotalHalibut$document". After doing this, whenever I load a video on Youtube, it constantly refreshes, each time adding an extra segment onto the URL, eventually leading to an error about the /watch URL being too long. Am I doing something wrong, or has Youtube changed something?

Any help would be great!
DaJamsta123
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby Flaim » Tue May 20, 2014 11:05 pm

:!: i updated the from 1.2 to 1.3. to be easier to setup, squished the constant refresh bug (it could only happen if you changed from userURL to userName) and added a brief explanation on how to change "settings" :wink:
Code: Select all
    // ==UserScript==
    // @name        Expose Youtube Uploader Name in URL
    // @namespace   schippi
    // @description Used to expose a Youtube uploaders displayname in the URL
    // @include     http://www.youtube.com/watch*
    // @include     https://www.youtube.com/watch*
    // @version     1.3
    // @grant       none
    // ==/UserScript==
     
    // Credits go to Schippi and Dubious for doing the base work which I've modified here.
     
     
    var setup = "user";
    // only this  /\  is to be edited depending on what you want.
    // change "user" to "channel" if you wish to use the safer method of not unlocking ads for channels with same name
     
    var url = window.location.href;
    if ( url.search( "user=" ) == -1)
    {
        if ( document.getElementById( "watch7-user-header" ) != null )
        {
            var channelNameContainer = document.getElementsByClassName("yt-user-name")[0];
            var channelName = channelNameContainer.innerHTML;
           
           
            if(setup == "user")
            {
               channelName = channelName.replace( ' ', '' );
               window.location.href = url + "&user=" + channelName;
            };
           
            if(setup == "channel")
            {
                var channelURL = channelNameContainer.getAttribute("href");
                channelURL = channelURL.replace( '/channel/', '' );
                window.location.href = url + "&user=" + channelURL;
            };
        }
    }
Flaim
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby DaJamsta123 » Wed May 21, 2014 12:14 am

So, I put that new code in, and am I right in saying you don't have to put a specific channel name in anywhere in that code? Without adding any channel names and leaving as is, the constant refresh stopped, and the channel name is now displayed at the top as something like "https://www.youtube.com/watch?v=zymf7o5K9UU&user=TotalBiscuit,The%20Cynical%20Brit". However, I can't seem to work out how to then add the filter to addblock plus.
DaJamsta123
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby Flaim » Wed May 21, 2014 2:20 am

DaJamsta123 wrote:So, I put that new code in, and am I right in saying you don't have to put a specific channel name in anywhere in that code? Without adding any channel names and leaving as is, the constant refresh stopped, and the channel name is now displayed at the top as something like "https://www.youtube.com/watch?v=zymf7o5K9UU&user=TotalBiscuit,The%20Cynical%20Brit". However, I can't seem to work out how to then add the filter to addblock plus.


that's the exception rule you have to add to adblock:
Code: Select all
@@||youtube.com/watch*user=CHANNELNAMEOFYOURGUY$document

ofc CHANNELNAMEOFYOURGUY stand for what is written in the url. in your case that would be
Code: Select all
@@||youtube.com/watch*user=TotalBiscuit$document


there's a video on youtube explaining it better than i could via text.
https://www.youtube.com/watch?v=QUSjNY2R_RA
Flaim
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby DaJamsta123 » Wed May 21, 2014 11:12 am

Yep, that seemed to work! :D

I think what I may have been doing wrong (which was partially pointed out in the video description) was that I was using MagicActions for Youtube, which had the block ads thing enabled.

One more question though, if I want to do this for other channels, do I just have to add another filter to AddBlock?

Thanks a bunch :)
DaJamsta123
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby Flaim » Wed May 21, 2014 4:22 pm

DaJamsta123 wrote:One more question though, if I want to do this for other channels, do I just have to add another filter to AddBlock?

not filter, whitelist entry. (i think that's what you meant anyway ^^)
for example if you now wanted to whitelist my youtube channel (just kidding. nobody watches my channel anyway :wink: ) you would have to add
Code: Select all
@@||youtube.com/watch*user=Flaim$document

to adblock and then you would allow ads on both channels, totalbiscuit and mine.
you can repeat this process for any channel you want to unlock ads for.


best regards,
Flaim
Flaim
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby DaJamsta123 » Wed May 21, 2014 5:02 pm

Adding this to the filter tab in AdBlock Plus seems to work, maybe it calls it something different because I'm in Chrome. There is another tab called Whitelisted Domains, but I should think that's just for normal URL's to be whitelisted. Oh wlee, what I have works, so thanks :)
DaJamsta123
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby Flaim » Wed May 21, 2014 6:48 pm

DaJamsta123 wrote:Adding this to the filter tab in AdBlock Plus seems to work, maybe it calls it something different because I'm in Chrome. There is another tab called Whitelisted Domains, but I should think that's just for normal URL's to be whitelisted. Oh wlee, what I have works, so thanks :)

sorry, just looked at my adblock and you're right. they named it "filter" while in reality it is supposed to be called whitelist or exception...
Flaim
 

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby kurtextrem » Fri May 23, 2014 7:14 pm

I don't think we need this "full" "whitelist". We just need a filter list to only allow the image ads on the right side (above the suggested videos) and the in-video ads (those which pop up after a specific amount of time). Only the pre-video ads-videos are annoying and should be blocked. That's a start, but it needs a bit more to get my idea "working":
Code: Select all
@@||youtube.com/watch*$elemhide
@@||googleads.g.doubleclick.net/*$domain=youtube.com
@@||pubads.g.doubleclick.net/*$domain=youtube.com
@@||googlesyndication.com/*$domain=youtube.com

That however doesn't unblock those 3: Image


I'm not all that familiar with the ABP syntax, could someone provide the correct whitelist filters for the 3 requests at the bottom? :)
kurtextrem
 
Posts: 3
Joined: Wed Oct 19, 2011 6:55 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby xtreemmasheen3k2 » Mon Jun 23, 2014 12:05 am

Found a script that will display the new string of characters used to identify a channel's ID. So instead of the filter of @@|https://www.youtube.com/watch*user=CHANNEL being the channel name (for example, @@|https://www.youtube.com/watch*user=TotalHalibut), it will now be the string of characters found in the link to the user's channel in his videos (in TotalBiscuit's case, @@|https://www.youtube.com/watch*user=UCy1Ms_5qBTawC-k7PVjHXKQ). I uploaded it here:
https://greasyfork.org/scripts/2734-you ... by-channel

Code: Select all
// ==UserScript==
// @name        Youtube - Whitelist by Channel
// @namespace   schippi (modified by AcasShows)
// @include     http*://*.youtube.com/watch*
// @include     http*://youtube.com/watch*
// @description Whitelist Youtube Videos from only channels you wish to support
// @version     1.1
// ==/UserScript==
     
    var u = window.location.href;
    if(u.search("user=") == -1){
       if (!! document.getElementById("ud")) {
          var user = document.getElementById("ud").getElementsByTagName("a")[0].getAttribute("href").split("/")[2];
            window.location.href = u+"&user="+user;
        }
        else if (!! document.getElementById("body")) {
          user = document.getElementById("watch7-user-header").getElementsByTagName("a")[0].getAttribute("href").split("/")[2]
            window.location.href = u+"&user="+user;
        }
       else {
            alert('script failed');
       }
       
    }
xtreemmasheen3k2
 
Posts: 6
Joined: Sun Jun 22, 2014 11:55 pm

Re: Suggestion: Enabling YouTube Ads Depending on Channel

Postby The Binary Son » Sat Aug 09, 2014 7:12 pm

Ok so I just posted a thread asking why disabling adblock for one video disables it for all, and if there's a way to change that, but I was directed here and my thread was locked.

I originally just wanted to know how to enable ads PER VIDEO not PER CHANNEL, but I'm guessing the former is impossible?

Regarding the latter, I've read just now the entirety of this thread, and as someone who doesn't code, doesn't have greasemonkey or tampermonkey or know what those are, I remain extremely confused.

Assuming a solution has been found - and it appears one has been - can someone PLEASE just write up a step-by-step process on how to do this? I'll install, copy/paste, whatever I have to, but I'm sorry I'm stupid but I can't for the life of me figure out what to do to achieve this. Any help would be GREATLY APPRECIATED!!!

EDIT: I just clicked someones "greasyfork" link and there appears to be a step by step process. I'll check that now but again any additional help would be great.
The Binary Son
 
Posts: 12
Joined: Sun Jun 05, 2011 10:23 pm


PreviousNext

Return to Adblock Plus development

Who is online

Users browsing this forum: No registered users and 1 guest