Jump to content

I was discussing the possibility of some sort of extension that could disable ad block for certain YouTube channels in another thread.

 

I was wondering if somebody was up to the task of creating some sort of extension that could disable ad block on LinusTechTips videos.

 

Just want the forum to be able to contribute back in some way :)

 

I'm not experienced enough myself to make it but i though somebody might.

 

Supposedly it's doable: https://adblockplus.org/forum/viewtopic.php?t=12189

 

Cheers!

export PS1='\[\033[1;30m\]┌╼ \[\033[1;32m\]\u@\h\[\033[1;30m\] ╾╼ \[\033[0;34m\]\w\[\033[0;36m\]\n\[\033[1;30m\]└╼ \[\033[1;37m\]'


"All your threads are belong to /dev/null"


| 80's Terminal Keyboard Conversion | $5 Graphics Card Silence Mod Tutorial | 485KH/s R9 270X | The Smallest Ethernet Cable | Ass Pennies | My Screenfetch |

Link to post
Share on other sites

I was discussing the possibility of some sort of extension that could disable ad block for certain YouTube channels in another thread.

 

I was wondering if somebody was up to the task of creating some sort of extension that could disable ad block on LinusTechTips videos.

 

Just want the forum to be able to contribute back in some way :)

 

Supposedly it's doable: https://adblockplus.org/forum/viewtopic.php?t=12189

 

Cheers!

k i read some of the posts and i still dont understand how to do it, maybe because i dont use adblock im missing things but if i could do that i would get it.

i5 3570 | MSI GD-65 Gaming | OCZ Vertex 60gb ssd | WD Green 1TB HDD | NZXT Phantom | TP-Link Wifi card | H100 | 5850


“I snort instant coffee because it’s easier on my nose than cocaine"


 

Link to post
Share on other sites

Basically the only way to do it is to load the actual html then parse it for the channel name, but that will make it a security flaw and allow a malicious user to track your websites, and probably affect page loading times.

However, when I label an element <class="adbar"> it's blocked in adblock plus on chrome and ff so it must do something similar already.

HTTP/2 203

Link to post
Share on other sites

Not sure I understand. If you watch his videos on /watch=31312?21 etc, then the URL's (since randomly generated for each video) would be different so AdBlock wouldn't be able to filter since it has no defining url to filter upon.

 

And I think what Colonel is getting at is having adblock disabled based on elements of the page? (probably like the linus tech tips subscribe logo)

 

A cheap way of doing it would be to make a filter subscription for adblock where all of his videos are manualy inputed. Either way I don't see an issue in just having adblock disabled for youtube as a whole.

Link to post
Share on other sites

Not sure I understand. If you watch his videos on /watch=31312?21 etc, then the URL's (since randomly generated for each video) would be different so AdBlock wouldn't be able to filter since it has no defining url to filter upon.

 

And I think what Colonel is getting at is having adblock disabled based on elements of the page? (probably like the linus tech tips subscribe logo)

 

A cheap way of doing it would be to make a filter subscription for adblock where all of his videos are manualy inputed. Either way I don't see an issue in just having adblock disabled for youtube as a whole.

On youtube you have the channel name just under the video xaMBOLQ.png and if the blocker loads the page it can identify either this text or the target of the link and use that in the filter. However, adblock+ don't want to actually parse the content of the page, which is why it hasn't been implemented yet

HTTP/2 203

Link to post
Share on other sites

What you could do was create a plugin where you can enter website URL's and youtube channel names. This plugin then disables the adblock whenever you view one of the mentioned pages.

 

EDIT: ill try to something, although i have never done a chome extension.

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Okay i looked into this, there are some issues.

First of all, detecting and getting the channel name is the easy part, any one with basic javascript can do that.

However the difficult part is disabling the ad block.

Currently the Chrome API does not allow you to actively disable another extension (security issue, think if NORTON scan was disabled... thats not good).

There should be something called:

chrome.experimental.management
But i cant find documentation for it + its experimental.

Another thing you could do was to "hack" the JSON file in the Prefenreces (C:\Users\[uSERNAME]\AppData\Local\Google\Chrome\User Data\Default), i dont know if this is allowed so if anyone wish to do so please research before doing so!

But the thing you could do was something like:

To enabled/disabled an extension there is a "state" key for each extension, with 1 for enabled and 0 for disabled.

You can edit this, however i don't know if it works while Chrome is running, as i haven't tried it.

A total another way is to "hack" the Ad Block and directly disable it that way, which if you tingle with their code, could be done easy. (also im not sure if this is allowed so check before doing so)

Read more here: http://stackoverflow.com/questions/6287030/how-do-i-enable-disable-google-chrome-extensions-via-console

Currently i'm off this, as it is just way to time consuming. However if someone would send a little cash my way i could code it in a jiffy! ;)

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Okay i looked into this, there are some issues.First of all, detecting and getting the channel name is the easy part, any one with basic javascript can do that.However the difficult part is disabling the ad block.Currently the Chrome API does not allow you to actively disable another extension (security issue, think if NORTON scan was disabled... thats not good).There should be something called:

chrome.experimental.management
But i cant find documentation for it + its experimental.Another thing you could do was to "hack" the JSON file in the Prefenreces (~/.config/google-chrome/Default/Preferences), i dont know if this is allowed so if anyone wish to do so please research before doing so!But the thing you could do was something like:To enabled/disabled an extension there is a "state" key for each extension, with 1 for enabled and 0 for disabled. You can edit this, however i don't know if it works while Chrome is running, as i haven't tried it. A total another way is to "hack" the Ad Block and directly disable it that way, which if you tingle with their code, could be done easy. (also im not sure if this is allowed so check before doing so)Read more here: http://stackoverflow.com/questions/6287030/how-do-i-enable-disable-google-chrome-extensions-via-consoleCurrently i'm off this, as it is just way to time consuming. However if someone would send a little cash my way i could code it in a jiffy! ;)

All I have is brownie points, sorry.

export PS1='\[\033[1;30m\]┌╼ \[\033[1;32m\]\u@\h\[\033[1;30m\] ╾╼ \[\033[0;34m\]\w\[\033[0;36m\]\n\[\033[1;30m\]└╼ \[\033[1;37m\]'


"All your threads are belong to /dev/null"


| 80's Terminal Keyboard Conversion | $5 Graphics Card Silence Mod Tutorial | 485KH/s R9 270X | The Smallest Ethernet Cable | Ass Pennies | My Screenfetch |

Link to post
Share on other sites

All I have is brownie points, sorry.

:P Well i have alot of other projects so cant really spend "that" much time on something, i've already used way to much time in the Chrome API documentation :P

 

Also it should not be that difficult, as long as you know the basics of javascript and know how to search the Chrome API documentation (yep its that hard...). Really anyone with the time, should be able to create this :)

 

EDIT: and the details i made above should lead you towards the right thing :)

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

:P Well i have alot of other projects so cant really spend "that" much time on something, i've already used way to much time in the Chrome API documentation :P

Also it should not be that difficult, as long as you know the basics of javascript and know how to search the Chrome API documentation (yep its that hard...). Really anyone with the time, should be able to create this :)

EDIT: and the details i made above should lead you towards the right thing :)

That's a shame, I didn't think it would take that much time :P

export PS1='\[\033[1;30m\]┌╼ \[\033[1;32m\]\u@\h\[\033[1;30m\] ╾╼ \[\033[0;34m\]\w\[\033[0;36m\]\n\[\033[1;30m\]└╼ \[\033[1;37m\]'


"All your threads are belong to /dev/null"


| 80's Terminal Keyboard Conversion | $5 Graphics Card Silence Mod Tutorial | 485KH/s R9 270X | The Smallest Ethernet Cable | Ass Pennies | My Screenfetch |

Link to post
Share on other sites

That's a shame, I didn't think it would take that much time :P

Well the "quickest" way would just to uninstall the ad block :P

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Well the "quickest" way would just to uninstall the ad block :P

Yeah, but that defeats the purpose of ad block and the idea :/

export PS1='\[\033[1;30m\]┌╼ \[\033[1;32m\]\u@\h\[\033[1;30m\] ╾╼ \[\033[0;34m\]\w\[\033[0;36m\]\n\[\033[1;30m\]└╼ \[\033[1;37m\]'


"All your threads are belong to /dev/null"


| 80's Terminal Keyboard Conversion | $5 Graphics Card Silence Mod Tutorial | 485KH/s R9 270X | The Smallest Ethernet Cable | Ass Pennies | My Screenfetch |

Link to post
Share on other sites

Okay i looked into this, there are some issues.

First of all, detecting and getting the channel name is the easy part, any one with basic javascript can do that.

However the difficult part is disabling the ad block.

Currently the Chrome API does not allow you to actively disable another extension (security issue, think if NORTON scan was disabled... thats not good).

There should be something called:

chrome.experimental.management
But i cant find documentation for it + its experimental.

Another thing you could do was to "hack" the JSON file in the Prefenreces (C:\Users\[uSERNAME]\AppData\Local\Google\Chrome\User Data\Default), i dont know if this is allowed so if anyone wish to do so please research before doing so!

But the thing you could do was something like:

To enabled/disabled an extension there is a "state" key for each extension, with 1 for enabled and 0 for disabled.

You can edit this, however i don't know if it works while Chrome is running, as i haven't tried it.

A total another way is to "hack" the Ad Block and directly disable it that way, which if you tingle with their code, could be done easy. (also im not sure if this is allowed so check before doing so)

Read more here: http://stackoverflow.com/questions/6287030/how-do-i-enable-disable-google-chrome-extensions-via-console

Currently i'm off this, as it is just way to time consuming. However if someone would send a little cash my way i could code it in a jiffy! ;)

 

You can enable and disable adblock while running, just checked.

 

The whole problem is that loading pages would take longer.

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to post
Share on other sites

Here are some more info:

            "manifest": {               "background": {                  "scripts": [ "jquery/jquery.min.js", "port.js", "functions.js", "stats.js", "filtering/domainset.js", "filtering/filteroptions.js", "filtering/fifocache.js", "filtering/filtertypes.js", "filtering/filterset.js", "filtering/myfilters.js", "filtering/filternormalizer.js", "idlehandler.js", "background.js" ]               },               "browser_action": {                  "default_icon": {                     "19": "img/icon19.png",                     "38": "img/icon38.png"                  },                  "default_popup": "button/popup.html",                  "default_title": "AdBlock"               },               "content_scripts": [ {                  "all_frames": true,                  "js": [ "port.js", "functions.js", "filtering/filteroptions.js", "adblock_start_common.js", "adblock_start_chrome.js" ],                  "matches": [ "http://*/*", "https://*/*" ],                  "run_at": "document_start"               }, {                  "all_frames": true,                  "js": [ "bandaids.js" ],                  "matches": [ "*://*.mail.live.com/*", "*://*.mastertoons.com/*" ],                  "run_at": "document_start"               }, {                  "all_frames": false,                  "js": [ "uiscripts/blacklisting/rightclick_hook.js" ],                  "matches": [ "http://*/*", "https://*/*" ],                  "run_at": "document_end"               } ],               "content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; connect-src *; frame-src 'self' https://chromeadblock.com",               "current_locale": "en_US",               "default_locale": "en",               "description": "The most popular Chrome extension, with over 15 million users!  Blocks ads all over the web.",               "icons": {                  "128": "img/icon128.png",                  "16": "img/icon16.png",                  "48": "img/icon48.png"               },               "incognito": "spanning",               "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZWWNkerYNFB0SIg87WwcrcniMYkCqxLz4OB3CLNoogUUsHN+Rk9vRB7o3Jjc4shlz2LBvAbtPbrGkU+NK9Hc3ubVydzpnoRDEl1RKz3GhqKFkECvTyAxrsKainXH+4Ni2+K7bg1U0tLoQMPJ9f3ieYLIwXeHh9+lYXQi6soq0pwIDAQAB",               "manifest_version": 2,               "minimum_chrome_version": "23",               "name": "AdBlock",               "options_page": "options/index.html",               "permissions": [ "http://*/*", "https://*/*", "contextMenus", "tabs", "idle", "webRequest", "webRequestBlocking", "webNavigation" ],               "update_url": "https://clients2.google.com/service/update2/crx",               "version": "2.5.63",               "web_accessible_resources": [ "img/icon24.png", "jquery/css/images/ui-bg_inset-hard_100_fcfdfd_1x100.png", "jquery/css/images/ui-icons_056b93_256x240.png", "jquery/css/images/ui-icons_d8e7f3_256x240.png", "jquery/css/jquery-ui.custom.css", "jquery/css/override-page.css" ]            },            "path": "gighmmpiobklfepjocnamgkkbiglidom\\2.5.63_0",            "state": 1,            "was_installed_by_default": false

If you have developed a Chrome extension before this might look familiar, as it is the manifest within the Prefences folder.

 

Just edit the "state": 1, to 0 and it should work (in theory).

 

Another way is to fiddle with the adblock it self (https://chrome.google.com/webstore/detail/adblock/gighmmpiobklfepjocnamgkkbiglidom)

  $("#div_pause_adblock").click(function() {    BG.adblock_is_paused(true);    BG.updateButtonUIAndContextMenus();    window.close();  });

and:

 $("#div_status_paused a").click(function() {    BG.adblock_is_paused(false);    BG.handlerBehaviorChanged();    BG.updateButtonUIAndContextMenus();    window.close();  });

That was what i found. good luck coders :)

 

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

You can enable and disable adblock while running, just checked.

 

The whole problem is that loading pages would take longer.

What method did you use?

 

And why would loading pages take longer?

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

What method did you use?

 

And why would loading pages take longer?

Go to Chrome Extension page and disable it.

 

Because it would have to scan the page first and decide whether or not to use adblocker.

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to post
Share on other sites

Go to Chrome Extension page and disable it.

 

Because it would have to scan the page first and decide whether or not to use adblocker.

Well of cause you can disable the Ad Block from within Chrome.....................................................................................................................

 

The method i explained was to fiddle with the Chrome Preferences, which can cause Chrome to crash if you modify them in run time (or not?)..

 

Also the time that it would need to calculate whether to use adblock or not would not be any problem for loading time.... Remember that the adblock itself needs to calculate all elements on a webpage and see if they are ads, if they are they are blocked.

 

However, our extension should be executed before the adblock. So the adblock will not block the Ads and then be disabled, which would ruin the point of the whole extension.

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Well of cause you can disable the Ad Block from within Chrome.....................................................................................................................

 

The method i explained was to fiddle with the Chrome Preferences, which can cause Chrome to crash if you modify them in run time (or not?)..

 

Also the time that it would need to calculate whether to use adblock or not would not be any problem for loading time.... Remember that the adblock itself needs to calculate all elements on a webpage and see if they are ads, if they are they are blocked.

 

However, our extension should be executed before the adblock. So the adblock will not block the Ads and then be disabled, which would ruin the point of the whole extension.

Actually good point, I didn't consider that.

 

And you won't be able to edit any Chrome while using it since the file is in use.

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to post
Share on other sites

If you want the source code for adblock for chrome, I found this after a quick google: http://adblockforchrome.googlecode.com/svn/trunk/

and adblock plus: http://adblockplus.org/en/source

HTTP/2 203

Link to post
Share on other sites

Actually good point, I didn't consider that.

 

And you won't be able to edit any Chrome while using it since the file is in use.

 

Well, there are ways of going around that. Remember we are not talking about manual edit, but creating a program that would do it for us.

 

But my bet is to just fiddle with the Ad Block code itself, seems to be much more secure and stable. 

 

Also, you could make it so, that if the page should be on your lists of items where you want to show ads (maybe a linustechtips video), the extension would disable the ad blocker and the reload the page.

 

Would be the most simple way of doing so, and rather fast.

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

If you want the source code for adblock for chrome, I found this after a quick google: http://adblockforchrome.googlecode.com/svn/trunk/

and adblock plus: http://adblockplus.org/en/source

 

When you install it, they are to be found here: C:\Users\[uSERNAME]\AppData\Local\Google\Chrome\User Data\Default\Extensions

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Well, there are ways of going around that. Remember we are not talking about manual edit, but creating a program that would do it for us.

 

But my bet is to just fiddle with the Ad Block code itself, seems to be much more secure and stable. 

 

Also, you could make it so, that if the page should be on your lists of items where you want to show ads (maybe a linustechtips video), the extension would disable the ad blocker and the reload the page.

 

Would be the most simple way of doing so, and rather fast.

I don't believe there are ways around editing a file that's in use, but I could be wrong (want to link me for knowledge?).

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to post
Share on other sites

I don't believe there are ways around editing a file that's in use, but I could be wrong (want to link me for knowledge?).

 

Well what you could do was to pause the Chrome Process and the edit the file. However as i research more and more about the process of editing the Chrome Preferences, i understand that it is the way hardest and most unstable way of doing this.

 

Make an extension that launches these javascript functions:

http://adblockforchrome.googlecode.com/svn/trunk/button/popup.js:

  $("#div_status_paused a").click(function() {    BG.adblock_is_paused(false);    BG.handlerBehaviorChanged();    BG.updateButtonUIAndContextMenus();    window.close();  });

and:

  $("#div_pause_adblock").click(function() {    BG.adblock_is_paused(true);    BG.updateButtonUIAndContextMenus();    window.close();  });

For Ad Block plus.... It dosnt have a pause function.. So dont use it.

Best regards Zahlio,
Unity asset developer - Game developer (http://playsurvive.com) - Computer Science student

Link to post
Share on other sites

Guest
This topic is now closed to further replies.

×