Code Monkey home page Code Monkey logo

Comments (4)

tomleb3 avatar tomleb3 commented on July 29, 2024

You mean you already have a specific list of usernames you want to unfollow without having to select them from the list?

from instagramunfollowers.

guikfe avatar guikfe commented on July 29, 2024

Exactly. I'm asking that because instagram temporarily prevented the unfollowing action, so I would like to resume it after a few hours.

from instagramunfollowers.

tomleb3 avatar tomleb3 commented on July 29, 2024

Sorry, but it'll be a bit tricky to implement.
The unfollow action required the id number of the user.
So a list of usernames doesn't get us far in this case unfortunately.

from instagramunfollowers.

guikfe avatar guikfe commented on July 29, 2024

Hello,

I'm documenting here the Javascript code that I created and may help other users. This code aims to check multiple pages of InstagramUnfollowers and select items corresponding to a list of username.

It performs the following steps:

  1. Define a list of username and the amount of pages to be checked.
  2. Create the findInputByUsername function to locate the input element corresponding to each username using XPath.
  3. Create the checkInput function to evaluate the onchange attribute of the found element and execute the corresponding code.
  4. Iterate over each page and apply the above functions for each username in the list.

After all the users are selected, proceed with the normal flow by clicking UNFOLLOW.

var usernames = [
  /* Username list */
]
var pages = /* Page amount */;

function findInputByUsername(username) {
  var xpath = "//a[text()='" + username + "']";
  var matchingElement = document.evaluate(
    xpath,
    document,
    null,
    XPathResult.FIRST_ORDERED_NODE_TYPE,
    null
  ).singleNodeValue;

  if (matchingElement) {
    return matchingElement
      .parentElement
      .parentElement
      .parentElement
      .getElementsByTagName('input')[0];
  } else {
    return false;
  }
}

function checkInput(el) {
  var exp = el.getAttribute('onchange');
  eval(exp);
}

for (var index = 0; index < pages; index++) {
  usernames.forEach(function(username) {
    var el = findInputByUsername(username);

    if (el) {
      checkInput(el);
    }
  });

  nextPage();
}

Thanks

from instagramunfollowers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.