3 ms·
Here's code: https://pastebin.com/LEzbz4NN https://pastebin.com/LEzbz4NN Basically youtube sends ads data in a window.ytInitialPlayerResponse variable. My exte
by vbezhenar 4y ago
Here'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 ;)