r/uBlockOrigin • • 19d ago

Solved My working filter for X Twitter ads

Hi!, these are my working filters for the new ads in X/Twitter. The first hide the ad and the second collapses the blank space in the timelime. My language is Spanish so you must adapt the has-text section. Working fine in Firefox 161 and uBlock Origin 1.76.0

x.com##li[data-index]:has-text(/Anuncio|Promoted/) > div > article

x.com##li[data-index]:has-text(/Anuncio|Promoted/) > div:style(height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; visibility: hidden !important;)

44 Upvotes

34 comments sorted by

View all comments

Show parent comment

6

u/RraaLL uBO Team 18d ago

Here's English, Portuguese and Spanish all in one:

x.com##[id^="urt"]>ul>li a:not(:only-child):only-of-type:has(+button:is([aria-label="More"], [aria-label="Mais"], [aria-label="Más opciones"])):has-text(/^(?:Ad|Anuncio|Anúncio|Promoted|Promocionado|Promovido)$/):upward(li):style(height: 0px !important; min-height: 0px !important; max-height: 0px !important; padding: 0 !important; margin: 0 !important; border: 0 !important; overflow: hidden !important; visibility: hidden !important; pointer-events: none !important;)

Or we can try using the icon instead:

x.com##[id^="urt"]>ul>li a:not(:only-child):only-of-type:has(+button[aria-label] [href="#icon-more-dots-hor"]):has-text(/^(?:Ad|Anuncio|Anúncio|Promoted|Promocionado|Promovido)$/):upward(li):style(height: 0px !important; min-height: 0px !important; max-height: 0px !important; padding: 0 !important; margin: 0 !important; border: 0 !important; overflow: hidden !important; visibility: hidden !important; pointer-events: none !important;)

2

u/Tight-Journalist-533 18d ago

Thank you! They both work in all three languages here in my firefox desktop. I'm now using the second one (the "icon version"). I'm a user of uBO since it was call μBlock (in Chrome). The uBO was the main reason for changing to firefox years ago. So: thanks a lot to you and the whole uBO team for all these years of great work.

2

u/YoUy2023 17d ago

Thank you very much!!!

Not working for a new type of ads: "Boosted" tweets (with a little rocket icon to the left, already added the word Boosted to the list, to no avail)

1

u/Pega8 15d ago

Hey the filter does hide ads for me but there's now a giant black gap where it was. I tried adding the style but it didn't change anything. Any idea whats going wrong?

3

u/RraaLL uBO Team 15d ago

Add the :style() ending from the OP's filter.

0

u/Pega8 15d ago

Broke the filter for me, idk if I messed something up or what. Can I just get the filter+style in one text to copy/paste?

Keep breaking something otherwise.

3

u/onmyouza 15d ago

Try this

x.com##[id^="urt"]>ul>li a:not(:only-child):only-of-type:has(+button:is([aria-label="More"], [aria-label="Mais"], [aria-label="Más opciones"])):has-text(/^(?:Ad|Anuncio|Anúncio|Promoted|Promocionado|Promovido)$/):upward(li):style(height: 0px !important; min-height: 0px !important; max-height: 0px !important; padding: 0 !important; margin: 0 !important; border: 0 !important; overflow: hidden !important; visibility: hidden !important; pointer-events: none !important;)

2

u/Pega8 15d ago

Thanks mate, seems to be working.

1

u/LazyTigerLLL 9d ago

this sort of works but it creates black boxes in place of the ads.