Closed tomerrr closed 12 months ago
FB has changed the HTML structure again.
Version 4.22 will be released shortly.
In the meantime, replace the _function nfgetCollectionOfPosts()'s code in the script with the following:
function nf_getCollectionOfPosts() {
let posts = [];
// -- various news feed queries
const queries = [
// -- July 2023 - fb tweaked the structure
'h3[dir="auto"] ~ div:not([class]) > div[class] > div',
// -- December 2022 - try the [data-pagelet] attribute
'span[id="ssrb_feed_start"] ~ div > div div[data-pagelet]',
// -- May 2023 - fb tweaked the structure
'h2[dir="auto"] ~ div:not([class]) > div[class]',
// -- February 2023 - fb tweaked the structure
'h3[dir="auto"] ~ div:not([class]) > div[class]',
// -- older ...
'span[id="ssrb_feed_start"] ~ div > h3 ~ div',
// -- 31/10/2022 - fb tweaked the structure
'h3[dir="auto"] ~ div:not([class]) > div[class] > div'
]
for (const query of queries) {
const nodeList = document.querySelectorAll(query);
if (nodeList.length > 1) {
posts = Array.from(nodeList);
break;
}
}
return posts;
}
Scratch that. FB is really messing up the HTML code. Will post another hotfix shortly.
many thanks, code works
Unfortunately, it still hiding some posts by accident.
FB is injecting random DIVs into the posts which messes up the query used for collection of posts.
Working on a fix for this.
Below is a temporary solution. Replace _function nfgetCollectionOfPosts() code with this:
function nf_getCollectionOfPosts() {
let posts = [];
// -- various news feed queries
const queries = [
// -- July 2023 - fb tweaked the structure - random div levels.
// -- - home news feed
'h3[dir="auto"] ~ div > div > div div.x1yztbdb:not([role])',
// -- - "recent" feed
'h2[dir="auto"] ~ div > div > div div.x1yztbdb:not([role])',
// -- December 2022 - try the [data-pagelet] attribute
'span[id="ssrb_feed_start"] ~ div > div div[data-pagelet]',
// -- May 2023 - fb tweaked the structure
'h2[dir="auto"] ~ div:not([class]) > div[class]',
// -- February 2023 - fb tweaked the structure
'h3[dir="auto"] ~ div:not([class]) > div[class]',
// -- older ...
'span[id="ssrb_feed_start"] ~ div > h3 ~ div',
// -- 31/10/2022 - fb tweaked the structure
'h3[dir="auto"] ~ div:not([class]) > div[class] > div'
]
for (const query of queries) {
const nodeList = document.querySelectorAll(query);
if (nodeList.length > 1) {
posts = Array.from(nodeList);
break;
}
}
return posts;
}
Version 4.22 released with fix.
ver 4.21 chrome 114.0.5735.198 / Fedora 37 tested also on Firefox Nightly 116.0a1 / Windows 10 TamperMonkey v4.19.0 (on both) once script enabled, I can only see a single post, the rest are blinking (loading) disabling script and feed return to normal