Skip to content

Instantly share code, notes, and snippets.

@cejaramillof
Last active August 12, 2023 01:24
Show Gist options
  • Save cejaramillof/30e583eaca1ac2be67493d39ebf6fa10 to your computer and use it in GitHub Desktop.
Save cejaramillof/30e583eaca1ac2be67493d39ebf6fa10 to your computer and use it in GitHub Desktop.
Automate follower acceptance for private Instagram accounts using this script
const timeBetweenClicks = 4000;
const textContent_ofConfirmButton = "Confirmar"; // TODO: Change for your language
function getElementByXpath(path) {
return document.evaluate(
path,
document,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null
).singleNodeValue;
}
setTimeout(function () {
getElementByXpath(
"/html/body/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div[1]/div/div/div/div/div[2]/div[6]/span/div/a"
).click();
setTimeout(function () {
getElementByXpath(
"/html/body/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div[1]/div/div/div[2]/div/div/div/div/div[2]"
).click();
setTimeout(function () {
const amountOfChildrens = getElementByXpath(
"/html/body/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div[1]/div/div/div[2]/div/div/div/div"
).children.length;
for (var i = 1; i <= amountOfChildrens; i++) {
setTimeout(function () {
const btn = getElementByXpath(
"/html/body/div[2]/div/div/div[2]/div/div/div/div[1]/div[1]/div[1]/div/div/div[2]/div/div/div/div/div[" +
i +
"]/div[3]/div[1]/div"
);
if ((btn.textContent = textContent_ofConfirmButton)) btn.click();
}, timeBetweenClicks);
}
}, timeBetweenClicks);
}, timeBetweenClicks);
}, timeBetweenClicks);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment