KudoAmine / Hide Ads on Facebook

Sponsored stuff isn't being hidden - note that using innertext won't work anymore because facebook is obfuscating the "Sponsored" into stuff like the following:

<span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">S</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">p</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">S</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">o</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">p</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">n</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">s</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">o</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">o</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">j</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">n</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">r</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">s</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">o</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">b</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">r</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">e</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">e</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">v</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">y</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 u_tklsojeh2">d</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">d</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">w</span></span><span class="y_tklsojeh1 n_tklsojehk l_tklsojehe"><span class="y_tklsojeh1 p_tklsojeh5">k</span></span></span>

Yeah... That renders as "Sponsored". They use obfuscated and regenerated classes and other bloat to make traditional detection difficult.

Example:

<span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">S</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">p</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">S</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">o</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">p</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">n</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">s</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">o</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">o</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">j</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">n</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">r</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">s</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">o</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">b</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">r</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">e</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">e</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">v</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">y</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 u_tklsojeh2">d</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">d</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">w</span>
    </span>
    <span class="y_tklsojeh1 n_tklsojehk l_tklsojehe">
        <span class="y_tklsojeh1 p_tklsojeh5">k</span>
    </span>
</span>

Re: @ajsnyde:

Please reread this section of the TOS and this FAQ for proper formatting. Additional information on presentation can be found at this FAQ entry if a code change is recommended.

Had you not put in your first comment to clarify this code snippet the default TOS action would have been applied. I've corrected your mistake (and beautified your code block which should have been a code fence) this time.

Thank you for your cooperation.
OUJS Admin

Re: @ajsnyde:

They use obfuscated and regenerated classes and other bloat to make traditional detection difficult.

Agreed... however there are other CSS selectors for pattern matching. FB isn't all that wise (nothing new here) when it comes to this and the script can be updated to do some more intense matching to curtail the privacy and security invasion if present. Perhaps matching on y_tk, n_tk, l_tk, and/or p_tk will work for the time being depending on where they start in class.

Since I'm not, and never will be, on FB I haven't tracked their tokenization of their ad system (which you really only need to post one set of them)... but this might be a start to improve the .user.js

I'm not sure if this works consistently for everyone but instead of searching on "[data-testid*="test"]" searching on "[id^=feedsubtitle]" is working for me.

Re: @ajsnyde:

As I tried, innerText does actually get the right text, here is what it returns when I use it for that element:
InnerText returns the right text
Well, it's the right text with some spaces or so, but since I'm using indexOf to check for these sponsored texts, it doesn't matter.

So, I believe the reason for why the script isn't working for you is something else that I will state in the next reply.

Re: @middlerob:

That can be a solution as well, searching for id instead of data-testid

but since [data-testid*="test"] doesn't work for you means you have some different value there..

For me, all feed posts' element (that is for the "Sponsored" text), its data-testid value start with test-
Here is an example:

Thus, the script works fine for me, also I've heard from people that it worked for them too.

So my conclusion is that some FB users have different values in there than others, and in that case I won't be able to make the script work for everyone, instead, people should change the value to what is shown to them.

And by the way, if I were to use what you suggested ([id^=feedsubtitle]), it won't work, since for me the id starts with fe_edsubtitle and not feedsubtitle.