3 ms·
I use proxy to remove youtube ads.
by vbezhenar 4y ago
I use proxy to remove youtube ads.
- djfobbz 4y agoCan you shine some more light on how exactly you do this? Would love to try it out myself!
- vbezhenar 4y agoHere's code: https://pastebin.com/LEzbz4NN https://pastebin.com/LEzbz4NN Basically youtube sends ads data in a window.ytInitialPlayerResponse variable. My extension loads before and intercepts this variable with proxy to prevent setting of window.ytInitialPlayerResponse.adPlacements field. When I was writing this code, I looked into ublock origin filters, so this idea or may be even code could have been borrowed there, I don't really remember. I also override JSON.parse and Response.json functions, because youtube can also send ad data with AJAX. One of those might be unnecessary, I'm not really sure.
- djfobbz 4y agoVerified...this is very nifty indeed! Thank you for sharing, now I can finally remove my AdBlock extension as it kept polluting my dev console with browser-polyfill errors ;)