[GH-ISSUE #55] Unfollow list of usernames #26

Closed
opened 2026-03-02 03:42:43 +03:00 by kerem · 4 comments
Owner

Originally created by @guikfe on GitHub (Jan 27, 2023).
Original GitHub issue: https://github.com/davidarroyo1234/InstagramUnfollowers/issues/55

Is it possible to inject a list of usernames by manipulating some global variable and then calling the unfollow function on it?

Originally created by @guikfe on GitHub (Jan 27, 2023). Original GitHub issue: https://github.com/davidarroyo1234/InstagramUnfollowers/issues/55 Is it possible to inject a list of usernames by manipulating some global variable and then calling the unfollow function on it?
kerem closed this issue 2026-03-02 03:42:44 +03:00
Author
Owner

@tomleb3 commented on GitHub (Jan 27, 2023):

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

<!-- gh-comment-id:1406850554 --> @tomleb3 commented on GitHub (Jan 27, 2023): You mean you already have a specific list of usernames you want to unfollow without having to select them from the list?
Author
Owner

@guikfe commented on GitHub (Jan 27, 2023):

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

<!-- gh-comment-id:1406898572 --> @guikfe commented on GitHub (Jan 27, 2023): Exactly. I'm asking that because instagram temporarily prevented the unfollowing action, so I would like to resume it after a few hours.
Author
Owner

@tomleb3 commented on GitHub (Jan 29, 2023):

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.

<!-- gh-comment-id:1407726853 --> @tomleb3 commented on GitHub (Jan 29, 2023): 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.
Author
Owner

@guikfe commented on GitHub (Feb 1, 2023):

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

<!-- gh-comment-id:1412793761 --> @guikfe commented on GitHub (Feb 1, 2023): 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`. ```js 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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/InstagramUnfollowers#26
No description provided.