-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter cost cumulates on endless scrolling sites (facebook) and end up being disabled until reload #3335
Comments
I am not sure if this is a bug or just how XHR works (which the whole FB feed is based on and which probably relates to your step 7). If the XHR response loads a new DOM object (sponsored post) uBO may not be able to detect it the same way as loading the initial DOM. So if you want not to see sponsored posts perhaps there should be a way to block the XHR itself. Personally I don't see any sponsored posts on FB at all. I use uMatrix with the following settings: In uBO I have all the lists enabled (except those which are already in uMatrix). I also have 3 additional lists (remaining from older versions of uBO). You may want to have look at them, they are related to FB annoyances: https://easylist-downloads.adblockplus.org/fb_annoyances_full.txt |
The curious thing to me though is that the feed initially loads via xhr as well, so I'm not sure if there's some timeout after which uBlock stops checking the page or if there's some bug in uBlock. It seems to me that uBlock should be able to block content that's loaded after the fact, so I think it's something that should be supported since not supporting this provides a super easy way for advertisers to circumvent uBlock. I tried adding the annoyances list but that doesn't seem to have any affect on the sponsored posts. The frustrating thing for me is that blocking via these css-style filters is clearly an intended function of uBlock, and I have a rule that works perfectly to pick out sponsored posts, but it just won't apply 100% of the time, so I think that's a bug. |
It is fairly easy to test if uBO applies cosmetic filtering to newly loaded (via XHR) DOM elements. Still it is better to block the loading of content rather than hiding it post-factum. That's why I use the combination uMatrix + uBO as explained. My rules in uBO are:
plus all the 3rd party lists. So whatever succeeds to pass through uMatrix has to pass through these too which is not an easy thing. If you would like to stick with uBO you may try as a first step to enable all filters one by one and see if enabling any particular one results in not seeing sponsored posts any more. That would indicate that the particular list includes a static rule for that. If they still show up, you could try putting uBO in hard mode (check wiki). The third step would be to try my setting. And ultimately we should all stop using FB, block it on a DNS or even TCP level. Forever :) |
Blocking at the request level would only work if only the sponsored post is loaded in that request. The feed loads a whole set of posts in a single request, so blocking the request would prevent the feed from loading any additional items. |
@gorhill I see, I wasn't checking the console. Do I just need to make the rule more specific? Add more direct ancestor operators perhaps, to avoid expensive exhaustive searches? Looks like it wasn't disabling the filter for me until I scrolled down for a few more ajax requests. |
I tried turning off cosmetic filtering in FB, refreshing and still I don't see any sponsored posts when I scroll down. I haven't really investigated in depth. I was just trying to help by suggesting what works for me. |
I think I need to calculate the cost in a better way than how it is now. The current approach is quite naive (but easy to implement), and I put it in there as a quick fix to address the performance issue reported in #2984 (comment). Your filter is not that bad, but the current way of computing cost needs to be better, it needs to assess the cost for the last say, 10 seconds, rather than compute the cost cumulatively forever. |
Ah, that explains why it gets disabled after a few requests for me. I'll update the issue title to more accurately represent what the core issue is. @T33REX I didn't mean to dismiss what works for you, it's a valid solution for some people. Unfortunately, facebook is really inconsistent about showing ads - I just had to scroll down about 20 or 30 ajax requests to get another one to show, so maybe if you keep scrolling you'll hit one. Or maybe your setup is somehow blocking it. I don't really have much desire to add uMatrix to my addons, since I like to avoid configured addons as much as possible (which is why I only run uBlock with default settings + a couple facebook custom rules). |
So I actually noticed that uBlock's main filters file has several filters that get disabled due to this issue, so the filter's I've been adding are redundant I think:
|
Alright, upon investigating all this, turns out things are much more complicated than I thought.
So I will come up with solution which addresses all these points. |
Filter issues MUST NOT be reported here. Read first: https://github.com/gorhill/uBlock/blob/master/CONTRIBUTING.md
Describe the issue
Adding a custom filter to filter facebook posts in my feed doesn't "stick", it stops working after reloading the page or also if you keep scrolling - you will see more sponsored posts that can be blocked by the exact same filter but were not blocked presumably because they loaded after uBlock checked.
One or more specific URLs where the issue occurs
https://www.facebook.com/
Screenshot in which the issue can be seen
Steps for anyone to reproduce the issue
##body div[role="feed"] div[id^="hyperfeed_story_id_"]:if(div[id^="feed_subtitle_"] a:matches-css-after(content: "Sponsored"))
Your settings
100% Default settings
Your filter lists
100% Default filters
Your custom filters (if any)
The text was updated successfully, but these errors were encountered: