facebook-clean-my-feeds icon indicating copy to clipboard operation
facebook-clean-my-feeds copied to clipboard

[Survey] Delayed filtering

Open thiendt2k1 opened this issue 3 years ago • 17 comments

Does anyone experience delayed in filtering, like only after 3 or 5s the filtering can kick in, especially for newer posts after 50 60-th :/ Sometimes it kick in, some don't even load into filtering and just stand there, unfiltered. is there a performance issue with my laptop or it's a common issues? Thanks. https://anonfiles.com/t9J99aEey9/2022-10-27_08-26-26_mp4 Here is HTML of the 2 post that not filtering in case you need to check: https://anotepad.com/notes/5tc3mjga

thiendt2k1 avatar Oct 27 '22 01:10 thiendt2k1

I sometimes see fb being "slow" - even with the script disabled.

I often get the "slow" down after viewing several group posts and fb is loading up 1-200 consecutive Suggested posts.

Not too sure why some of the Sponsored & Suggested posts slipped through in your feed stream.

I'll review the performance of the code. to to make sure it isn't being to aggressive.

Are you using version 4.09?

zbluebugz avatar Oct 27 '22 16:10 zbluebugz

yes, 4.09 English

thiendt2k1 avatar Oct 28 '22 02:10 thiendt2k1

i think i got it, i got 2 or more kinds of sponsored post, and suggested, here is 2 of them(sponsored): https://anotepad.com/notes/ktx5a2t8 also suggested: https://anotepad.com/notes/447mdm4y can you add another case in the filter and give me for a test? thanks P/s: i included html code of both filtered and unfiltered in 1 file each for both sponsor and suggestion

thiendt2k1 avatar Oct 28 '22 06:10 thiendt2k1

I've had a quick look at the first file - couldn't see anything odd about it. As for the second file, I could not see the contents of that file.

I've uploaded a development copy of the script, that makes FB appear a little bit more nippy. This copy is a work-in-progress. It is listed as beta-400-beta.js in the /beta/archive folder. You're welcome to try it out - it will be available for download for a short period of time.

You might want to tweak two lines in the code to adjust the cleaning frequency. Line 1408: mutationsMax: 3,

  • this indicates how often to run the clean up code for the whole page
  • it triggers the code to run on every nth new element (of a certain types) to run
  • setting this number above 5 can cause the "cleaning crew" to have a longer "tea break" before doing some cleaning ...

Line 1418: scanCountMaxLoop: 5,

  • this indicates how often to re-scan a post
  • sometimes, FB hasn't finished creating a post, so this line tells the "cleaning crew" how many times to clean the "room" (aka post) ...
  • setting this number above 20 can cause the "cleaning crew" to become very busy ...

FYI, upto version v4.09, the code would do the cleaning tasks everytime a certain new element was added and each post cleaned 12 times (not 12 times per new element). The above two lines aims to reduce the frequency of the cleaning.

zbluebugz avatar Oct 28 '22 13:10 zbluebugz

much better, i set the above to 6 and 8 respectively, which make the load much faster and more stable, i got to about 100 no problem, the after 100, there is still a slight delay but acceptable as sponsored and suggest shows and then gone, but that's ok for me. Thanks for the tips. Excellent work!!

thiendt2k1 avatar Oct 28 '22 13:10 thiendt2k1

Thanks for the positive feedback.

Good to see you've found a sweet spot for the code on your laptop.

Can you give us an update after a week or so?

zbluebugz avatar Oct 28 '22 18:10 zbluebugz

FB has changed the main news feed structure.

A new version of beta-400-beta.js has been uploaded - will be up for a few hours for you to download.

I have not released this version to the public yet as I'm still testing it.

Before overwriting your copy, take note of the two numbers you changed in the code.

This new version has some additional code for adjusting the executing of the filtering code.

  • It starts off in aggressive mode for X number of mutations (to catch those components that sits outside of the news feed stream)
  • Then switches to non-aggressive mode and run the code for every nth mutatations and rescan each news feed post X number of times.

You'll need to adjust mutationsNonAgressiveMax and scanCountMaxLoop

If you find the code is not hiding certain elements at the start, you could try tweaking mutationsAggressiveMax to have a higher number.

// - mutations speed mode, 1 = aggressive, 2 = non-aggressive
mutationsMode: 1,
// - on start, how many mutations to process consecutively, before switching to non-agressive mode
mutationsAggressiveMax: 250,
// - non-agressive mode - which NTH element to trigger the code
mutationsNonAgressiveMax: 4,
// - mutations counter (used with either mutationsAgressiveMax or mutationsNonAgressiveMax)
mutationsCount: 0,
// - how many times to scan a post
scanCountStart: 0,
scanCountMaxLoop: 10, // was 12

zbluebugz avatar Nov 01 '22 02:11 zbluebugz

News Feed suggested/recommendations are slipping through.

Here's the code snippet to update in your copy of the code - replace function nf_isSuggested(...) with the following:

function nf_isSuggested(post) {
    // - check if any of the suggestions / recommendations type post
    // -- nb: <name> commented / <name> replied to a commment posts have similar structure - but have extra elements ...
    // -- nb: x people recently commented posts have similar structure - suggested/recommended posts don't start with a number ...
    let query = ':scope > div > div > div > div > div > div > div > div > div > div > div > div:nth-of-type(2) > div > div:nth-of-type(1) > div > div > div > div > span';
    let elSuggestion = querySelectorAllNoChildren(post, query, 1);
    // console.info(log+'isSuggested:', elSuggestion.length, elSuggestion);
    if (elSuggestion.length === 0) {
        query = ':scope > div > div > div > div > div > div > div > div > div > div > div:nth-of-type(2) > div > div:nth-of-type(1) > div > div > div > div > span';
        elSuggestion = querySelectorAllNoChildren(post, query, 1);
    }
    if (elSuggestion.length > 0) {
        const pattern = /([0-9]|[\u0660-\u0669])/;
        let firstCharacter = cleanText(elSuggestion[0].textContent).trim().slice(0, 1);
        // console.info(log+'isSuggested - match test:', firstCharacter, pattern.test(firstCharacter), pattern.test(firstCharacter) ? 'No': 'Yes' );
        return (pattern.test(firstCharacter)) ? '' : KeyWords.NF_SUGGESTIONS[VARS.language];
    }
    else {
        return '';
    }
}

zbluebugz avatar Nov 12 '22 20:11 zbluebugz

I was about to post about this today, but it's working as expected, thanks!

thiendt2k1 avatar Nov 13 '22 04:11 thiendt2k1

I've uploaded a development copy of the script with some changes. This copy is a work-in-progress.

It is listed as beta-400-beta.js in the /beta/archive folder.

You're welcome to try it out - it will be available for download for a short period of time.

New features added:

  • Share text-filters between news/groups and videos feeds
  • Include image's ALT text in text filters check
  • Marketplace text filter

Note: The aggressive-mode code has been adjusted.

  • It starts off by doing nothing, then be aggressive for a short period before switching to non-aggressive mode for the rest of the time.

zbluebugz avatar Nov 22 '22 18:11 zbluebugz

Hi, sorry for the long waiting time, I think the order should be non-aggressive -> aggressive -> doing nothing, as initially doing nothing is something similar to not using for the first 15 post

thiendt2k1 avatar Nov 27 '22 16:11 thiendt2k1

Hmmm, sounds like the script is a bit slow to start on your computer. On my computer, it starts quite early and the site was still building non-feed elements.

So, I implemented a "sleep" facility to allow the site to do it's stuff before the script did the filtering.

Change line 1488: mutationsInitSkip: 400, to have a lower count of elements to skip at start - from 400 down to say 200.

May need to adjust line 1490: mutationsAggressiveMax: 150, to process more elements in fast mode, before switching to slow mode.

zbluebugz avatar Nov 27 '22 17:11 zbluebugz

ok works as expected, i change "mutationsInitSkip" to 200, "mutationsAggressiveMax" to 350 and it's smoooth again👌

thiendt2k1 avatar Nov 27 '22 17:11 thiendt2k1

ok now we're back to square one, using the beta testing won't help anymore as it isn't filtered, even after i scroll through about 15 20 post(and only force filter using save in menu make the filter begin), i think we should roll back to previous version or try another one, as this version isn't working for me anymore...

thiendt2k1 avatar Dec 05 '22 08:12 thiendt2k1

Are you saying nothing is happening on start up and only kicks in when you press the Save button?

I have the next version version (v4.12) ready to be published, but will hold off releasing for a few days due to rumours about Sponsored posts no longer being filtered. This version has a simplified start-up code - there's a bit of a delay before doing the filtering (no aggressive/passive modes).

zbluebugz avatar Dec 05 '22 11:12 zbluebugz

seems to have some trouble posting, i answered yesterday and now i see nothing, so here i go again The filtering is back to normal yesterday, even without delay, seems like my FB is their favorite code dump these days Will report back when the symptom show up again(and no, it's not because the sponsored filter don't work, it only delays)

thiendt2k1 avatar Dec 07 '22 03:12 thiendt2k1

FYI, there are some errors/bugs with the code which causes it to not to hide some elements when Verbosity's option is set to <no message>. Use either 1 post hidden. Rule: ______ or 7 posts hidden option for now.

Will be doing some more testing before releasing v4.12.

zbluebugz avatar Dec 07 '22 08:12 zbluebugz