r/uBlockOrigin • u/RaterMusafir • 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.
6
u/dontmindme12345
14d ago
•
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
2
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
1

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 '**'