Sunday, November 17, 2024
Google search engine
HomeLanguagesJavascriptHow to like multiple posts on facebook news feed automatically using JavaScript...

How to like multiple posts on facebook news feed automatically using JavaScript ?

In this article, we are going to learn how to like multiple posts automatically on the Facebook news feed. Many a time we waste too much time liking all the posts in our news feeds. So this script will help to reduce our time and effort by automating this task.

Approach:

  1. Make a variable post that points to an array of all the posts on the current page.
  2. Run a loop to iterate all the posts.
  3. Now we check if the post is not already liked.
  4. Then click on the like button of that post.

Below are the steps:

  • Go to the Facebook page using m.facebook.com
  • Sign in and open the news feed/homepage.
  • Open developer mode in Chrome by pressing Ctrl+Shift+I
  • Navigate to the console.
  • Now, run the below script. 

Example: This example shows the use of the above-explained approach.

javascript




var posts = document.getElementsByClassName("_15ko");
for(var i=0;i<posts.length;i++)
{
    if(posts[i].classList.contains("_77la")==false)
    {
        posts[i].click();
    }
}


Output:

Output

Note: Please ensure that there is a stable internet connection available so that the script runs smoothly. Also, ensure to visit Facebook with m.facebook.com, not www.facebook.com because this script works on the mobile version of Facebook only.

Note: This tutorial is for educational purpose only, please don’t use it for disturbing anyone or any unethical way.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments