Skip to content

Instantly share code, notes, and snippets.

@lfreneda
Last active June 6, 2021 04:13
Show Gist options
  • Save lfreneda/f6df9980192df6f389034a43a8f3037c to your computer and use it in GitHub Desktop.
Save lfreneda/f6df9980192df6f389034a43a8f3037c to your computer and use it in GitHub Desktop.
instagram auto follow
var index = 0;
var buttons = null;
var scrollCount = 0;
var followedCount = 0;
function clickAndWait() {
if (buttons === null) {
buttons = document.querySelectorAll('li button');
}
console.log('let me click');
var hasClicked = false;
if (buttons[index]) {
var buttonText = String(buttons[index].innerText).toLowerCase().trim();
console.log('button text is ' + buttonText);
if (buttonText == 'follow') {
console.log('clicking on it (' + index + ')');
buttons[index].click();
hasClicked = true;
}
}
index++;
if (hasClicked) {
console.log('cliked <3 lets wait a little..');
followedCount++;
console.log('#### total followed people: ' + followedCount);
setTimeout(clickAndWait, 30000);
} else {
if (index > buttons.length) {
console.log('already clicked on all available buttons.. my work is done here.');
} else {
console.log('non clicked </3 next button..');
clickAndWait();
}
}
}
function loadFollowers() {
var scrollContent = document.querySelector('._4gt3b');
if (scrollContent) {
var currentScrollTop = scrollContent.scrollTop;
scrollContent.scrollTop = currentScrollTop + 99999;
scrollCount++;
} else {
console.log('there is no scroll content, fuk-off, let me skip it');
clickAndWait();
return;
}
console.log('loading followers ... [' + scrollCount + ']');
if (scrollCount < 50) {
setTimeout(loadFollowers, 3000);
} else {
console.log('starting following muwhahahaha ]:)');
clickAndWait();
}
};
function start() { loadFollowers(); }
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment