Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can you shine some more light on how exactly you do this? Would love to try it out myself!


Here's code: 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.


Verified...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 ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: