As social media continues to be an integral part of our lives, it’s important to manage our online presence and experiences. For me, Facebook was becoming overwhelming with the clutter and negativity on my timeline. I found myself constantly scrolling past posts that didn’t interest me or that were simply too negative.
That’s when I decided to take control of my Facebook experience by creating scripts to automate the process of following and unfollowing people. By doing so, I could curate my timeline to only show the content that I wanted to see.
Using these scripts, I was able to follow people who shared content that aligned with my interests and unfollow those who consistently posted negative or irrelevant content. This allowed me to have a more positive and personalized experience on Facebook.
(async () => {
sleep = (ms) => new Promise((r) => setTimeout(r, ms));
mores = Array.from(
document.querySelectorAll(
'[aria-label="All friends"] [aria-label="More"]'
)
);
for (more of mores) {
await new Promise(async (resolve, reject) => {
more.click();
await sleep(10);
more.scrollIntoView();
const unfollow = Array.from(
document.querySelectorAll('[role="menuitem"]')
)?.find((el) =>
el.textContent.contains('Stop seeing posts but stay friends.')
);
if (!unfollow) {
more.click();
return resolve();
}
unfollow.click();
await sleep(2000);
return resolve();
});
}
})();
(async () => {
sleep = (ms) => new Promise((r) => setTimeout(r, ms));
mores = Array.from(
document.querySelectorAll(
'[aria-label="All friends"] [aria-label="More"]'
)
);
for (more of mores) {
await new Promise(async (resolve, reject) => {
more.click();
await sleep(10);
more.scrollIntoView();
const follow = Array.from(
document.querySelectorAll('[role="menuitem"]')
)?.find((el) => el.textContent.contains('See posts from'));
if (!follow) {
more.click();
return resolve();
}
follow.click();
await sleep(2000);
return resolve();
});
}
})();
The code is also posted in a gist .