4 ms·
Facebook's "sponsored" content is a disgusting mess of <span> elements with autogenerated IDs in order to bypass ad-blockers. How did you get around it?
by petargyurov 6y ago
Facebook's "sponsored" content is a disgusting mess of <span> elements with autogenerated IDs in order to bypass ad-blockers. How did you get around it?
- username90 6y agoCan't you just remove all posts that aren't from people in your friend list?
- gnicholas 6y agoThis would also remove posts by FOF who tag your friends (e.g., your friend is tagged in a post by his wife, whom you're not friends with).
- lazycouchpotato 6y agohttps://addons.mozilla.org/en-US/firefox/addon/facebook-tracking-removal/ https://addons.mozilla.org/en-US/firefox/addon/facebook-trac... and https://addons.mozilla.org/en-US/firefox/addon/facebook-container/ https://addons.mozilla.org/en-US/firefox/addon/facebook-cont... are essential add-ons to be able to tolerate browsing Facebook on a PC.
- marc_abonce 6y agoI didn't know about FacebookTrackingRemoval. I always used facebook_adblock[1] instead, which seems to do almost the same and has worked very well for me most of the time. I'm also seeing other comments here trying to figure out other solutions. It's making me wonder how much duplicated effort is being spent on the same problem. [1] https://addons.mozilla.org/en-US/firefox/addon/fb_ad_block/ https://addons.mozilla.org/en-US/firefox/addon/fb_ad_block/
- lini 6y agoIt's a cat and mouse game. Every couple of months FB tries a new version of the HTML layout with slightly changed elements and every time someone writes a CSS selector that manages to find the appropriate tag for the sponsored story and hide it. Currently with the new FB redesign it's: div[data-pagelet^="FeedUnit"]:has([role^=button]:has(> span:has-text(S)):not(:has-text(1)):not(:has-text(2)):not(:has-text(3)):not(:has-text(4)):not(:has-text(5)):not(:has-text(6)):not(:has-text(7)):not(:has-text(8)):not(span:has-text(9)):not(span:has-text(w)))
- dawnerd 6y agoSimilar tactic on Twitter as well. I'm not even doing it for ad blocking necessarily, just to hide features I don't want like "who to follow" or all those nonstop COVID updates. In case anyone interested: https://github.com/dawnerd/ublock-filters/blob/master/sites/twitter.txt https://github.com/dawnerd/ublock-filters/blob/master/sites/...
- coryfklein 6y agoI find this so crazy! It says "Promoted" right there. I can use my browser's inspector to click on the element to select the div and then delete it. Is there no simple way to accomplish the same in a browser extension without bringing in some crazy AI solution? Just read the webpage as it is rendered to an actual human, identify the x/y coordinates of the element, pass that to Firefox/Chrome/Safari's element selector, and delete. Voila! I'm sure there's a very good reason why this exact solution just doesn't work, but I'd love to hear it explained, because it seems so simple to me. Then again I'm a backend guy, and I just don't even know frontend.
- acmecorps 6y agoI think, the uBlock Origin context menu does that?
- roryokane 6y ago> Just read the webpage as it is rendered to an actual human Humans read web pages using their vision. So what you’re proposing is to look at the final rendered image of text instead of the DOM tree. The only way to do that would be to perform OCR (https://en.wikipedia.org/wiki/Optical_character_recognition https://en.wikipedia.org/wiki/Optical_character_recognition) on a screenshot of the whole web page. This would be possible, but I think nobody’s tried because it feels overly complicated, and many OCR libraries can’t understand text 100% reliably, not even computer-rendered text. Also remember that the OCR library would have to run in JavaScript. Would it run fast enough to block the ad before the user sees it? Would it annoy the user by spinning up their computer’s fan? > identify the x/y coordinates of the element This wouldn’t be too too hard to implement using `document.elementsFromPoint(x, y)`. This part isn’t the problem.
- gnud 6y agoI keep planning to write this script, but never get around to it. One of those messy autogenerated ID spans is "aria-labeledby" a span that clearly contains the text "sponsored". And it would be hard (legally) for Facebook to stop doing that.
- lozaning 6y agoI have a plugin for chrome called FB Purity that removes all the embedded ads, and also strictly list the feed in chronological order.
- sizzle 6y agoDo what I did, delete your Facebook...
- InvaderFizz 6y agoSpeaking of sponsored content. Both eBay and Amazon are unusable without uBO to remove sponsored listings that completely mess up my sorting and filtering.
- tomp 6y agoIn javascript, `span.innerText == "sponsored"` ... I was surprised it was so easy, but it probably won't work for long though.