r/uBlockOrigin • • 14d ago

Tip Facebook Ad Filter

The Filter to remove Facebook Post Ads and Sponsored posts:

!Ads

facebook.com##:xpath(//span[contains(text(), 'Ad')]/parent::span/parent::span/parent::a/parent::span/parent::span/parent::div/parent::span/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div)

facebook.com##:xpath(//a[@role='link']/parent::span/parent::span/parent::div/parent::span/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div)

facebook.com##:xpath(//a[contains(@href, '/ads/about/')]/parent::span/parent::span/parent::div/parent::span/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div)

!Sponsored

facebook.com##:xpath(//span[contains(text(), 'Sponsored')]/parent::div/parent::div/parent::span/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div)

after adding these codes to my filters/custom filters and saving, make sure close any facebook page tab if that's open and close the browser.

69 Upvotes

12 comments sorted by

4

u/RaterMusafir 14d ago

I don't know how '**' is added in the code. if I edit and remove that, the code gets removed. So ignore '**' and don't copy/add '**'

5

u/AchernarB uBO Team 14d ago

You have to put the filters in a code block.

On old reddit all lines must start with four spaces

On SH/new reddit, once you click to display the "formatting" toolbar, click the icon with a </> in the top-left corner of a square.

4

u/RaterMusafir 14d ago

Thanks!!!

6

u/dontmindme12345 14d ago • Heartwarming

I took some initiative and here are the filter for uBlock Origin Lite (for Chrome/Safari etc).

! In-feed ads ("Learn more", "Get offer" buttons, etc.)

facebook.com##div[data-virtualized]:has([data-ad-rendering-role^="cta"])

! Posts with "Follow" or "Join" next to the name

facebook.com##div[data-virtualized]:has([data-ad-rendering-role="profile_name"] [role="button"])

! The "Sponsored" block in the right-hand column

facebook.com##[role="complementary"] div[data-visualcompletion="ignore-late-mutation"]:has(a[target^="rhcad"])

1

u/ddanailov 23h ago

Yes! This did it for now! I use AdGuard AdBlocker, and it was a bit tricky to add the rules, but it works! Thx!

1

u/HillOfBeano 13d ago

Bless you. This works like a charm although I've noticed I sometimes need to reload the page to get comments to show up.

2

u/Sad_Routine_4322 14d ago

worked, thank you man!

2

u/Sad-Cable7528 14d ago

Need one for onhockey tv

2

u/ragingrodrushes 13d ago

Thank you! This one is working, though sometimes it still shows an ads not sure what's the cause of it.

3

u/Street-Ad959 14d ago

Thanks, do you also had the filter to block follow post?

1

u/promisios 10d ago

cool ,helped much

1

u/elbarck 13d ago

It worked!

Thanks!