FB - Clean my feeds

Hide Sponsored and Suggested posts in FB's News Feed, Groups Feed, Watch Videos Feed and Marketplace Feed

< Feedback on FB - Clean my feeds

Question/comment

§
Posted: 2022-10-10

There seems to be a bug where in News feed posts like the one in the image gets flagged as Suggestions / Recommendations but its clearly just people who recently commented to a post by my friend. I just wanted to inform you so you can check it out on your side.

zbluebugzAuthor
§
Posted: 2022-10-11

Thanks for letting me know about this bug.

I'll have a look and see if I can reproduce it.

§
Posted: 2022-10-12

I tried to get a copy of the code from facebook and here is what I got. I hope it helps.
https://hastebin.com/cohefumati.xml

zbluebugzAuthor
§
Posted: 2022-10-13

Thank you for HTML code sample - it will help me to tweak the Suggestions/Recommendations rule.

§
Posted: 2022-10-13

Figured I would try and find more code incase you wanted to compare it with the first one I sent. It seems to me the News feed posts with "XX people recently commented." are the only ones being falsely flagged. Below are 2 code snippets that I hope can help you.

This one has no script running.
https://hastebin.com/keyasireka.xml

This one has your script running incase you wanted to compare it to that.
https://hastebin.com/uboxavikot.xml

Again hope these help you.

zbluebugzAuthor
§
Posted: 2022-10-13

Thanks for the additional sample HTML code - it helped me to give me some ideas on how to exclude the commented posts.

Now waiting for FB to show me a Suggested/Recommended post or two in the News Feed so I can revise and test the rule.

zbluebugzAuthor
§
Posted: 2022-10-14

Preliminary tests indicate the following changes would work. Can you test it for me, please? - Let me know how you get on.

Edit the script's code.

Replace the following:


function nf_isSuggested(post) {
// - check if any of the suggestions / recommendations type post
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 suggestion = querySelectorAllNoChildren(post, query, 0);
return (suggestion.length === 0) ? '' : KeyWords.NF_SUGGESTIONS[VARS.language];
}


with:


function nf_isSuggested(post) {
// - check if any of the suggestions / recommendations type post
// - needs two queries to reduce false-positive hits.
// - first query (primary) will get suggested/recommendations and xyz commented on post
// - and second query (secondary) refines the first one by excluding the xyz commented on post

// -- revised rule ::
let query1 = ':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:not(:scope > *)';
let query2 = 'div > div > div > span > h4 > span > a > strong > span:not(:scope > *)';
let suggestion = post.querySelectorAll(query1);
if (suggestion.length > 0) {
// -- have a suggested/recommendation or xyz commented on post
// -- apply query2 to exclude the commented on post.
let refined = post.querySelectorAll(query2);
return (refined.length === 0) ? '' : KeyWords.NF_SUGGESTIONS[VARS.language];
}
else {
return '';
}
}

§
Posted: 2022-10-14

Ok will do tests with new code on my end and will inform you if it has fixed the issue. It will take some time to test but I will get back to you ASAP.

§
Posted: 2022-10-14

Ok I did some checks on my News feed with the edited code and it seems to me there are new false positives, the posts that show "XX people recently commented." seem to be ignored now but the new ones are weird. I copied the code with and without your script enabled, links are below.

Without scirpt:
https://hastebin.com/ifahaqexez.xml
With script:
https://hastebin.com/jogetifame.xml

There are also Suggested posts that are now missed as well. Below are codes for 2 Suggested post that were ignored by the script.
https://hastebin.com/zogujuqebu.xml
https://hastebin.com/fepuxicole.xml

Hope this helps you find out why this happened.

zbluebugzAuthor
§
Posted: 2022-10-14

Thank you for doing the testing - muchly appreciated!

I will review those posts code and work out another way of detecting the news feed's suggestions.

zbluebugzAuthor
§
Posted: 2022-10-15

Can you try this one, please.

Replace the function nf_isSuggested(..) code with this one, please:


function nf_isSuggested(post) {
// - check if any of the suggestions / recommendations type post
// -- nb: commented / 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);
if (elSuggestion.length > 0 ) {
const pattern = /([0-9]|[\u0660-\u0669])/;
let firstCharacter = cleanText(elSuggestion[0].textContent).trim().slice(0,1);
return (pattern.test(firstCharacter)) ? '' : KeyWords.NF_SUGGESTIONS[VARS.language] ;
}
else {
return '';
}
}

§
Posted: 2022-10-15

Thanks for the updated script code. It seems to be working properly based on what I see now but I will need to observe for a day or so before we can be sure its working properly but based on what I have seen from the couple of hours of checking my News Feed it seems to be flagging things properly. Will let you know after a day or so of testing.

zbluebugzAuthor
§
Posted: 2022-10-15

Thanks for the good feedback. Take your time in doing the testing - I'm in no rush to release the next version.

§
Posted: 2022-10-17

After a day of testing the new script code I have found no falsely flagged post yet. I shall inform you in the coming days if there are any other issues I find while checking my News Feed. Again thanks for the update and quick fix for the script.

zbluebugzAuthor
§
Posted: 2022-10-20

version 4.05 has been released - includes fixes for Sponsored and Suggested posts.

Thanks for your help!

§
Posted: 2022-10-20

Found a new bug, seems like "Your Pages and profiles" on the Right Panel of facebook is being flagged by Suggestions / Recommendation rule.

zbluebugzAuthor
§
Posted: 2022-10-20

Thanks for spotting that one - something I haven't seen for a while. I'll try and refine that side-bar rule.

zbluebugzAuthor
§
Posted: 2022-10-21

I have managed to reproduce this issue.

Replace the function nf_cleanTheConsoleTable(...) code with this one, please:


function nf_cleanTheConsoleTable(item = 'Sponsored') {
// -- mopping up the news feed aside panel. item values: Sponosored | Suggestions
let query = `div[role="complementary"] > div > div > div > span ~ div:first-of-type > div:not([data-visualcompletion])`;
let asideBoxes = Array.from(document.querySelectorAll(query));
// console.info(log + 'aside:', asideBoxes);
if (asideBoxes.length > 0) {
// -- only interested in the first container.
if (asideBoxes[0].childElementCount > 0) {
let elItem = null;
let reason = '';
if (item === 'Sponsored') {
elItem = asideBoxes[0].querySelector(`:scope > span:not([${postAtt}])`);
if (elItem && elItem.innerHTML.length > 0) {
reason = KeyWords.SPONSORED[VARS.language];
}
}
else if (item === 'Suggestions') {
elItem = asideBoxes[0].querySelector(`:scope > div:not([${postAtt}])`);
if (elItem && elItem.innerHTML.length > 0) {
// -- check for birthdays
let birthdays = Array.from(elItem.querySelectorAll('a[href="/events/birthdays/"]')).length > 0;
// -- check for "your pages and profiles"
let pagesAndProfiles = Array.from(elItem.querySelectorAll('div > i[data-visualcompletion="css-img"]')).length > 0;

if (birthdays === false && pagesAndProfiles === false){
reason = KeyWords.NF_SUGGESTIONS[VARS.language];
}
}
}
if (reason.length > 0) {
hideFeature(elItem, reason);
}
}
}
}

zbluebugzAuthor
§
Posted: 2022-10-21

Released a new version - 4.06.

Include fixes for News Feed's Sponsored Posts and side column's Suggested rules.

§
Posted: 2022-10-22

Thanks works flawlessly, will let you know if I find any other issues with the script.

Post reply

Sign in to post a reply.