Cool Trick : Like all Facebook posts at once

In this article, we are going to learn a cool trick in Facebook using JavaScript.

We are going to write a couple of lines of JavaScript codes which will like all the Facebook posts in the current browser.

Like all posts

var like_buttons = document.querySelectorAll('[aria-label="Like"]');
count = 0;
for(i=0;i<like_buttons.length;i++){
    like_buttons[i].click();
    count++;
}
console.log('Total Posts Liked : ' + count);

Remove Like from all posts

var like_buttons = document.querySelectorAll('[aria-label="Remove Like"]');
count = 0;
for(i=0;i<like_buttons.length;i++){
    like_buttons[i].click();
    count++;
}
console.log('Total Posts Removed Like : ' + count);

Refer this video for complete guidance :

Recommended For You

About the Author: Ritesh Ghimire

Ritesh is a Computer Engineer, Web Developer and an active cricket follower.